Home AMX User Forum AMXForums Archive Threads AMX Hardware

TCP Client Connection Shutdown on Reboot

I have a Netlinx system in which the Master opens TCP client connections to a number of different TCP servers (Escient Fireball, DigiOne SP device servers, etc.). Once connected, Netlinx and the devices work quite reliably but the problem comes when the Master needs to be rebooted (soft) or power cycled.

When Netlinx has a client connection open, unless that connection is closed, the server is generally unaware that the connection has gone away. Since most of the devices we are using allow only a single client to be connected at one time, it generally takes 5-10 minutes and sometimes longer before the server realizes the client has gone away at which point it shuts down the connection and allows Netlinx to connect once again.

Netlinx does not seem to support the ability to perform certain actions just prior to a reboot (such as an OFFLINE event for the Master which would run to completion before the reboot takes effect). This would only work in the case of a Studio or Diagnostics tool reboot anyway - power cycle is a case that can not be handled. We have implemented a reboot under a BUTTON_EVENT in which case we can perform shutdown actions before issuing the REBOOT() call but this still does not handle the Studio reboot case.

We have tried TCP Keepalive with some success but this is a chatty protocol and is not properly handled by all devices. It is however designed to address specifically this problem - the client going away without closing the socket connection.

It also appears that the Netlinx Master does not 'close' all open TCP connections prior to a reboot. If it did, this would solve the problem since it would generate a FIN to the TCP server and it would close the connection in response. In effect, using TCP Keepalive, we are forcing the issue since the lack of a response from the client or a RST from the Netlinx system once it reboots will result in the same thing.

Has anyone had any similar experiences or issues and does anyone know of any interesting ways to force TCP client connections to be closed in all but the power cycle case? Thanks in advance.

Comments

  • DHawthorneDHawthorne Posts: 4,584
    This won't help with inadvertent power outages, but you could make a shutdown routine that explicitly closes your TCP sessions. I wouldn't put it on a button, I would make a virtual device and trap for a command in the STRING event, then you can do a SEND_STRING <virtual>, "'SHUTDOWN'" or "'REBOOT'". For the rebott you could just have the routine generate the reboot as the last step, and in both cases, you could pop up warning pages to anyone using the system if this is an issue.
Sign In or Register to comment.