M mantracourt Member Licensed User Longtime User Aug 24, 2011 #1 It is unfortunate that there is no simple method to determine whether a remote server socket has closed its connection after you use a client socket to connect to it. I have seen several suggestions in the forum but none actually help me. Example: I connect to a remote server. At some point the remote server closes its socket. I have no way of knowing that I need to close and reconnect from my end. Suggestions that the error event is raised from an AsyncStreams object is not correct if the server simply closes the connection. Using the phone events to look for a network connection change does not help as a socket can be closed without any loss of network connection. I can see a couple of options. 1- If I stop getting data I can assume a socket closure and attempt a reconnect. Not very helpful when the data arrival is intentionally intermittent. 2- I get the server to send some sort of heartbeat message (that could help with item 1 above) or to respond to a client ping type command. Neither of which helps when the server functionality is outside of your control. Does anyone have any working solution to identifying when a connection is broken? Thank you
It is unfortunate that there is no simple method to determine whether a remote server socket has closed its connection after you use a client socket to connect to it. I have seen several suggestions in the forum but none actually help me. Example: I connect to a remote server. At some point the remote server closes its socket. I have no way of knowing that I need to close and reconnect from my end. Suggestions that the error event is raised from an AsyncStreams object is not correct if the server simply closes the connection. Using the phone events to look for a network connection change does not help as a socket can be closed without any loss of network connection. I can see a couple of options. 1- If I stop getting data I can assume a socket closure and attempt a reconnect. Not very helpful when the data arrival is intentionally intermittent. 2- I get the server to send some sort of heartbeat message (that could help with item 1 above) or to respond to a client ping type command. Neither of which helps when the server functionality is outside of your control. Does anyone have any working solution to identifying when a connection is broken? Thank you
Erel B4X founder Staff member Licensed User Longtime User Aug 25, 2011 #2 You are correct. It is missing a ConnectionEnded (or something like that) event. It will be added next week.
You are correct. It is missing a ConnectionEnded (or something like that) event. It will be added next week.
Erel B4X founder Staff member Licensed User Longtime User Aug 29, 2011 #3 Terminated event added: http://www.b4x.com/forum/additional...-randomaccessfile-v1-20-counting-streams.html
Terminated event added: http://www.b4x.com/forum/additional...-randomaccessfile-v1-20-counting-streams.html