I wonder if there is a convenient way of checking the availability of a server before trying to open a connection to it? My problem is that when using Connector.open the call blocks for ever if the server does not respond at the specified port. This results in the entire application freezing if the use inadvertently entered an invalid address for instance.
The code goes something like:
I don't seem to receive any time out exceptions, even though the third parameter is true.
connection = (StreamConnection) Connector.open(adr, Connector.READ_WRITE, true );
System.out.println("not working " + e.getMessage());
Is there any good way of solving this?