-1

I have a C++ server and client.

I am using the poll() system call to monitor sockets on the server for read-ready, write-ready and errors.

For some of the connections, I see the poll() detects an ECONNRESET after sending out a bunch of data and fails midway. On the client side too, I see a ECONNRESET being reported.

So essentially both sides are reporting that the remote side closed the connection.

How can this happen? How do I debug this? Is there any tcp layer logging that I can enable?

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
siri
  • 123
  • 1
  • 13

1 Answers1

1

Is there any tcp layer logging that I can enable?

The most common tool to enable you seeing what's going on at your low level IP transport channels is Wireshark.

You can inspect any packets send and received over your NIC in detail with that tool.

Another one is tcpdump for linux systems.

πάντα ῥεῖ
  • 1
  • 13
  • 116
  • 190
  • Unfortunately this is in a test environment with a lot of servers. I do not have control over the machines. Even if I did how do I capture packets exactly when this problem happens. – siri Jun 12 '17 at 19:18
  • @siri You only need to have control over your client machine to watch the traffic. – πάντα ῥεῖ Jun 12 '17 at 19:28
  • I have a lot of traffic going over that machine. This problem happens only sometimes. A lot of connections and all of them detect socket error 104 even in a successful case after a full transfer. Only in some cases I see the connection being reset on both sides in the middle of the transfer. How do I use tcpdump to capture this scenario? – siri Jun 12 '17 at 19:38
  • @siri Use filters, grep tools, whatever ... Sorry, I can't give better advice, it's not an easy task to capture such scenarios. – πάντα ῥεῖ Jun 12 '17 at 19:44