Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo
create_listener on an already opened port creates a second port on the exact same IP in windows. Don't know in Linux.
Logged In: YES
Check out this thread:
It is about this exact problem. There doesn't appear to be a good resolution to this on the windows platform. Fortunately it doesn't seem like a big deal but I'm open to suggestions for some sort of fix.
Steven Van Ingelgem
Logged In: YES
I was thinking, you will be listening on a LOCAL address... Why not try a connection to the requested IP/port with a timeout of a few milliseconds? That should do the trick of checking if the port is already in use.
The "problem" is because Apache is using SO_REUSEADDR & my program too I think... So all requests come to me, but that's not the point here ofcourse ;)
Well you can also listen on all local interfaces (this is the default). So just connecting to one to test it doesn't really work. Unless you find out what all of them could be and then try them all. But that is a pretty heavy handed solution to what seems like a minor issue.
Why exactly do you want to do this? Maybe there is a better way.
i want to run a webserver to provide webpages to the enduser... But ofcourse it should run on a separate port. I am just trying to determine if a port is in use or not ;-)
Ok, just try to connect to yourself then and if you get a response then it is in use :)