sBsaidus 0 Posted September 21, 2023 Hello, I have two(2) simple applications, A Server ( use TidTCPServer) and Client (use TidTCPClient) and they works well. But when I close the server application, the client one do not indicate that it is disconnected, even the OnDisconnect Event not works. This test is done on the same machine ( client & server are in the same machine (VM)) So, How can I see, or know that the server process does'nt exists or connection is lost in the client side. PS: I use Delphi 7 all updates made, indy 10.6.2. Thank you. Share this post Link to post
Remy Lebeau 1420 Posted September 21, 2023 (edited) Indy uses blocking sockets and synchronous I/O. The client's OnDisconnected event is fired when the *client* disconnects on its end. If the server disconnects first, there is no real-time notification of that. The client will notify your code only when the client tries to access the connection and gets an error from the OS, at which time it will raise an exception to your code, such as EIdConnClosedGracefully, etc. So, if you want timely notification of a remote disconnect, you need to actively send/read data. If your code is not using the connection for lengths of time, use a timer to poll for incoming data periodically. Or use a reading loop in a worker thread. Edited September 21, 2023 by Remy Lebeau 1 Share this post Link to post
sBsaidus 0 Posted September 21, 2023 Okey ... I see, Thank tou @Remy Lebeau You are the Best. Share this post Link to post