Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#10 create listener creates double socket on Windows

open
Davis
1
2007-08-18
2007-08-06
No

create_listener on an already opened port creates a second port on the exact same IP in windows. Don't know in Linux.

Discussion

  • Davis
    Davis
    2007-08-18

    • priority: 5 --> 1
     
  • Davis
    Davis
    2007-08-18

    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 ;)

     
  • Davis
    Davis
    2007-08-18

    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 ;-)

     
  • Davis
    Davis
    2007-08-19

    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 :)