Is there any way to detect network disconections on a Tcpip socket (SO independent)
I've already tryed
- writing in the sockect
- disconnect it after a predefined period of inactivity
I would like to know if there is another way to do it
Comments
Try to use high level interface to work with sockets: %IO.Socket, %IO.SocketCommon.
Look on %SYSTEM.INetInfo.Connected() [aka $ZUTIL(189)] or you can use tools of OS [for example see source code %SYSTEM.INetInfo.CheckAddressExist()]
You may also want to try Monitoring for Disconnect Mode (D mode)
(http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY…).
This mode prevents a Caché process from silent halting on disconnect, which occurs by default when the socket device is the process $principal. D mode garranties that process's error trap code will handle <DISCONNECT> errors anyway.