Grant Edwards wrote: > Diez B. Roggisch wrote: [Bryan Olson had written:] >>> It's not the issue here, but to specify the outgoing port >>> call bind(('', portnum)) before connect(). >> I wasn't aware of that. Cool. > > It's an interesting thing to know, but I've been doing TCP > stuff for many years and never run across a situation where > it's something I needed to do. If somebody in this thread > actually does need to do it, I'd be curious bout why...
One made-up example: Unix traditionally restricts port numbers below 1024 so that only root can use them. One might have a white-list of trusted Unix machines, and insist requests come from a port below 1024. I used the empty string for the address, which Python's socket module resolves to INADDR_ANY, but you can also use bind() to set a particular adapter. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list