I need to establish a TCP connection with a remote machine, but before I do that, I need to detect, if the port is in use by another application (if there is already one connection on this port). In other words I want to ensure that only one application is using the same port a time.
What is the way to do it in .NET?