Try to open a ServerSocket on the port. If you can, the port was available and you immediately close the socket again.
If you cannot, you get an exception (or an errorcode, check the API docs for ServerSocket) and you know the port is in use already.
Reputation Points: 1658
Solved Threads: 331
duckman
Offline 7,719 posts
since Nov 2004