I am confronted with the famous "Connection reset by peer: socket write error" issue. Here is one of its flavors.
I have two pieces of (java) software - client and server, both perfectly functional and working well for centuries all over the place. Servers are on public internet. Recently (at home) I've started to get connection drops on client side.
Client catches the reset when it tries to send something to server. This happens specifically when client runs on my home network and it sends requests with periods longer than 60 sec.
Client code if fairly basic:
socket = new Socket(address, port);
socket.setKeepAlive(true);
OutputStream os = socket.getOutputStream();
Every once in a while it does this:
os.write(bytes)
I used Wireshark to realize that connection is being forcefully dropped by "someone" and when client attempts to write, it gets the exception, handles it, re-connects and again when next request comes after longer than 60 sec, the "someone" drops the connection again. Now, I don't want to make special pinging to keep connection live.. I am 100% sure that server is not dropping anything, so it's got something to do with the idle connection.
My client is now on Windows 10, so I went ahead and modified registry KeepAliveTime value to less than 60 sec. This indeed had an affect, clients are now cool. But changing global KeepAliveTime is not a prudent solution.
I would like to understand - who is this "someone" forcefully dropping my good socket connections after precisely 60 sec? And how can I tell "him" to stop doing it, or do it less frequently.
(My environment is a typical Windows box at home behind NETGEAR router. It used to work before without issues and I guess that some of the OS updates recently started to cause this.)