I know that For TCP, we can only have one application listening on a single port at one time. Now if you had 2 network cards, you could have one application listen on the first IP and the second one on the second IP using the same port number.
Now in this case If I have to check whether a particular port is in use, how do I do that?
My intention is a port should be used by only one application even though there are multiple interfaces. Is it Ok if I list all the interfaces and bind with the port number with all those interfaces in a loop, or is there any better way to do this checking.