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 an error message.
How can I get this functionality through my java program?
You could run
netstat -aand parse the output.