This is an old problem that I recently left because I could not solve any solution and it affected only one server (so I just put my service in a different place). This user has problems with identical symptoms:
- C # .net synchronous tcp server
- The TcpClient object is assigned a lock on the TcpListener using the AcceptTcpClient method
- as soon as there is a TcpClient object, I pass it to a thread that calls the GetStream client method to create a NetworkStream
- this NetworkStream is looped, networkStream.Read is executed at each iteration (someBuffer, 0, 4096)
- right now the client and server are located on the same network, without any overloads talk about
- My server has a lot of memory to save
- if I download my server software to another computer, the problem disappears
- kicker: traffic from the network. Linux box goes through fine and on time.
The method tcpClient.AcceptTcpClient()blocks about a minute at a time, as a result, the server will have to read a huge block of bytes after a while, and not what it should do. It should do networkStream.Read () small blocks of bytes as often as they are sent (and the client sends them every 5 seconds, more than once per minute).
Previous comments to another user suggest that problems with sub-pairing or connectivity may be to blame, which seems reasonable at first. But actually it is not.
I went even further and installed batch analyzers on both the client and server. Results:
- the moment when the client sends a message displayed on the server analyzer
- /
- - , , -
- .NET- - ,
- .NET
:
- Intel PRO/1000 MT Network .NET
- Server 2003 R2, SP2
- .NET Framework: 2.0 SP2, 3.0 SP2, 3.5 SP1, 4 Client Profile, 4 Extended
- - , , .
user1110648