How do I find if a particular port is free on the local machine

I would like to find from a Java program if a particular port of the machine on which the program runs is free. I DO NOT want to bind to that port. I just want to identify if the port is free.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

MicheleMarconConnect With a Mentor Commented:
The only way of knowing it with Java is connecting... but you don't accept this solution.
don't think it can be done from java . would need native code I'd think

jacob_412Author Commented:
Thanks ! If it is not possible to check if a port is free without connecting, I guess I'll have to accept it an work on this solution.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.