How to make client socket wait for server socket
If client socket opens before the server socket, Java will generate a
ConnectionException. So I have to check whether the server is available
and keep waiting before executing
socketChannel.open(hostname, port)
in client thread. I've found an related API:
InetAddress.getByName(hostname).isReachable()
However, this still can't tell whether the socket on a specific port is
open. I think this problem should be common but I didn't get very useful
information from Google and other places.
No comments:
Post a Comment