3

I have a java 1.6 "client" running on a managed windows 2008 server. When the "client" starts up it connects to an external machine using:

socket = new Socket(host, port);

This socket connection has been closing on a weekly basis with the added issue of the "server" not recognising the closed socket. So when the "client" tries to immediately reconnect, the "server" thinks its already connected and disallows another connection.

We only now just realised that the timing of this coincides perfectly with the virus scanner.

Could these symptoms be caused by a virus scanner? The virus software is from Symantec, but I do not know more than that. I can get those details if you think it helps.

gjrwebber
  • 2,658
  • 2
  • 22
  • 26
  • 1
    I've seen virus scanners and security software packages from the likes of Symantec and McAfee do much worse. :) In any case, TCP/IP connections can go down for all kinds of reasons. Is there any way you can make your server code capable of accepting re-connects from the client? That's the more appropriate fix. – selbie Jan 22 '14 at 04:47
  • Also, you could check the Windows event logs (Control Panel -> Adminstrator tools -> Event viewer) to see if any strange network connectivity changes happened at the time of the disconnect. – selbie Jan 22 '14 at 04:48
  • @selbie that's the most annoying part. The server side continues to think the connection is open for some time. Event viewer is how we noticed symantec was running. – gjrwebber Jan 22 '14 at 21:23
  • Do you have access to the server source code? A good fix would be for the server to keep its listening socket open even after the client has connected. When it detects that the same client is re-connecting again, it simply drops the old connection. This would likely mean your protocol has to have some semantic of client's identifying themselves with some moniker separate from IP/port. – selbie Jan 22 '14 at 23:00
  • What exactly do you mean by 'disallows another connection' and 'continues to think the connection is open'? Servers don't behave like that. What's your evidence? – user207421 Jan 24 '14 at 00:30
  • @EJP my evidence it that after the connection is closed on the client side, it immediately tries to reconnect, but the server thinks the socket is still open, so disallows the new connection (as it only allows one connection for each client). Its almost like the socket disconnect signal never made it to the server. – gjrwebber Jan 24 '14 at 00:37
  • @selbie No I don't have access to the server code, but I have access to the developer. This is a legacy system whose protocol cannot be changed. – gjrwebber Jan 24 '14 at 00:44

1 Answers1

0

I'd think it is much more likely that something in the middle thinks the socket has timed out after being opened for so long and closes it.

Java-Sockets will not recognize a closed stream until sending something to the closed stream so maybe your problem is caused by this.

Prior99
  • 619
  • 5
  • 13