Getting a free TCP port & blocking it

theneb onetwofour at
Sat Mar 1 13:28:22 CET 2008

On Feb 29, 11:11 pm, Tim Roberts <t... at> wrote:
> theneb <onetwof... at> wrote:
> >Hi all,
> >I'm attempting to block a TCP port from any other application from
> >using it until I free it from python, this is so that:
> >1). Generate a random free user-space port
> >2). Generate the script for the external program with the port
> >3). Free the port before external program execution.
> What's the point?  Why can't the actual user of the port create the port,
> and then notify the other side of the port number?
The system the app will run on will be creating three instances of the
external application, the python app has to keep track of which port
the external app is running on.

> And why don't you just specify a port number of 0 and let the system assign
> you a free port number?
> --
> Tim Roberts, t... at
> Providenza & Boekelheide, Inc.

More information about the Python-list mailing list