check for unused ports and then grab one

Peter Hansen peter at engcorp.com
Wed Sep 15 13:24:48 EDT 2004


Alex Martelli wrote:

> Peter Hansen <peter at engcorp.com> wrote:
>>in the same situation I'd make the choice to assign a port to
>>the service permanently (and hardcode or whatever), but I have
>>to admit I don't have all the details so maybe I'd take your
>>approach, too. :-)
> 
> One key detail we have is that the current IP cannot be known in
> advance, thanks to DHCP -- it has to be communicated dynamically to a
> sys-admin workstation.  Given that key detail, I see no problem having
> to communicate the port number as well as the IP address, thus no
> advantage in hardwiring the port number -- as long as no firewalls and
> similar hacks are in the way, of course.

There's at least one advantage I can think of offhand, which is
that by assigning a port number in advance, I make troubleshooting
much easier... even possible!  Having each instance of the
server grab a possibly different port number would be a
major hassle when it came to things like trying to run
tcpdump or Ethereal or some other protocol analyzer, especially
if one wasn't on either the client or the server machine.

But I take your point.  Hardcoding the one thing when the
other cannot be provides less advantage than it normally
would.

-Peter



More information about the Python-list mailing list