cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
billyl
Level 3

what is the best way to check if a port is in use?

Hi,

What is the best way to check if a port is in use? We have application that specifically running on a port, and we need to check to see no other programs are using it before install.

Thanks!

Billy
Labels (1)
0 Kudos
(1) Reply
pv7721
Level 20

Try to open a server socket (a listening socket) on that port; if it suceeds, the port is yours, if not the port is already taken. Of course, there is no guarantee that between the time you check and the time your application is installed and up and running, some other application will use that port. Ideally, your application is registered with IANA on a well known port.
0 Kudos