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

مشاهدة النسخة كاملة : Socket forcibly closed



C# Programming
03-30-2009, 01:40 PM
I'm using a System.Net.Sockets.Socket in a server application to handle a large number of connections which receive a large amount of data. I have in incoming buffer of around 1/2MB to be read at a time using a NetworkStream wrapped around the socket. It is my understanding that a call to NetworkStream.Read will read what is available up to the buffer size and not necessarily wait until it has enough data to fill the buffer, is this correct?

The reason I ask is because I am getting connections dropped from the server side and when I dump the TCP stream I see the TCP window size drop until it hits 0 at which point the connection is dropped. The only explanation I can think of for this is that the NetworkStream.Read is waiting too long for data and the buffer is filling up meaning no more data can be received. Does this sound correct or could there be something else causing this problem?