Sockets - how to nominate local port number?

djmitchell djmitchell at optushome.com.au
Sat Jan 26 16:37:00 EST 2002


Hello group,

For a particular sockets application I'm working on, I need to be able to 
specify both the port number on the remote machine, *and* the port number 
on the local machine.  In other words, the function/method call to 
establish the connection needs to look something like this:
        ...
        socket = connect(remote_host, remote_port, local_port)
        ...

Any suggestions how to go about this?  For "normal" apps, you don't usually 
care about the local port number, but the security requirements of this 
particular application mean that I have to specify it.

Thanks in advance for any pointers

Dave Mitchell



More information about the Python-list mailing list