tags:

views:

35

answers:

1

Hi I am facing a problem. I want to detect whether socket connection with a particular ip address is already established in the system. In linux there are 4 desktops so if tcp socket connection is already established in 2nd desktop and I want to re-establish in third desktop or if I want to re-establish another connection using another user with the same ip address then I should receive error message.

How to get this functionality through java program

thanks Sunil Kumar Sahoo

+1  A: 

You could run netstat -a and parse the output.

mobrule
will this work for windows and Mac OS ?
Deepak
Some versions of Windows have a `netstat` command. I'm sure there is something equivalent on Mac OS.
mobrule