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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 ;)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
-Davis
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 ;-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=1166290
Originator: NO
Check out this thread:
http://twistedmatrix.com/trac/ticket/1151
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.
Logged In: YES
user_id=569271
Originator: 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 ;)
Logged In: YES
user_id=1166290
Originator: NO
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.
-Davis
Logged In: YES
user_id=569271
Originator: YES
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 ;-)
Logged In: YES
user_id=1166290
Originator: NO
Ok, just try to connect to yourself then and if you get a response then it is in use :)