Question

I have client server application that works with Firebird server. Everytime when clients connect to the server they(client apps) don't check if there is a network connection to the server so at this time my application sometimes freezes when the server computer is switched off or service has stopped, so first of all I need to check connection if remote host is switched on or at some port anything listening....

Before establishing the connection I need to check it and make sure server and service is running using Indy components.

Any ideas? also I can use IcmpClient to ping remote host and then establish connection but which is the most optimal way ?

Was it helpful?

Solution

If you just want to check if the server computer can be reached, you could do a "ping" to check that. However, if you want to check if a specific TCP port is open, then the only way to find that out is to actually do a proper connect, which leads to the "freezing" program while the connection times out if there is no-one listening on that port.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top