3
votes

Background:

  • C# .net synchronous Tcp server
  • a TcpClient object is assigned by blocking on a TcpListener with the AcceptTcpClient method
  • once there's a TcpClient object, I pass it to a thread that invokes the client's GetStream method to create a NetworkStream
  • this NetworkStream is looped over, in each iteration doing a networkStream.Read(someBuffer, 0, 4096)
  • right now client and server are located on the same network, with no congestion to speak of
  • my server has plenty of memory to spare
  • if I load my server software onto another machine, the problem goes away
  • the kicker: traffic from a network Linux box gets through fine and on time

My server has been functioning just fine for several months. However, over the past weekend instead of receiving small groups of bytes in quick succession, the place where the process begins ( tcpListener.AcceptTcpClient() ) only occurs every couple of minutes. So my server sits idle, then gets 30-50 client requests all bundled into one huge block of bytes. Needless to say this causes a huge delay and put strain on my server. If the clump of client requests is big enough, it can take my server 30 minutes to catch up.

In logging built into my clients, I can see them do network writes, and flush between each one. So the clients are functioning correctly.

This reaks of some kind of system intervention. Is my Tcp server (as describe above) bad, or is something in Windows interfering with my traffic, and how can I tell?

Thanks guys.

1
I guess the question is, what changed over the weekend? Code change? Network maintenance? Cleaning person swap out a router for a vacuum?Chris Shain
No code change, no change to the server. I'm poking around more to see what else could have changed.kmarks2
No service packs applied to server? It sounds like a connectivity problem, esp. since your code's been running well for a while and still does on another machine. Not sure what type of an organization you are in, but at big companies this can happen if the network admins change something about your switching hardware or the server admins apply SPs.Chris Shain
@ChrisShain The odd thing is that my Windows based clients traffic gets delayed, but traffic from a Linux server to my .net Tcp server gets through on time, just fine.kmarks2
Maybe your clients were all moved to a different subnet with lousy connectivity to your server's subnet. This definitely smells like a network problem.Chris Shain

1 Answers

1
votes

You might want to install some packet capture software at each Tcp endpoint. You'd be surprised. I'm suffering with a similar problem now, almost completely identical actually.

When I put capture software in place I noted that traffic between endpoints was fast and on time as expected.