المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : A problem while transferring data over the NetworkStream



C# Programming
06-02-2011, 02:11 PM
Hi,
I am trying to send a big file over a TCP connection using NetworkStream and TCPClient. Both the client and the server is written in C#.

There is no problem while transferring small files around the size of 300KB. My buffer size is 2KB and here is how the protocol works.

-Server requests the file.
-Client tells the server the size of the file, and then sends the first 2KB of it.
-The server asks for another chunk of the file -like, send 2KB data, starting from 42649-
-Client sends the chunk
-Server asks for more, and client sends it...
-When the end of file is reached, the client acknowledges the server that transfer is complete.

Without looking at the code, since it is too long to be posted here, can you see any possible problems that may be causing this problem? I even tried sleeping the thread while receiving and processing the incoming chunks of data.

Regards