OneClientServer in ts_tcpip will fail to call connect_callback under the following circumstances:
- A client connects (connect_callback correctly called)
- The client drops the connection. OneClientServer does not call connect_callback, as documented, because it doesn't monitor the client connection.
- A client connects. Here is where the problem arises. The last time connect_callback was called the connection was live, and the code recorded that. Now it's alive again, so it thinks the state has not changed and has no need to call connect_callback.
Two solutions that come to mind (which might go together):
- Monitor the connection. This would be nice for users but introduces some delay (depending on the polling frequency).
- Whenever a client tries to connect record the new connection state (like monitoring, but less frequent and still will not call the connection callback when a connection is lost).
These two might work best together.