[Tutor] control multiple FTP sessions using multiple ipconnectionsvia different com ports

Alan Gauld alan.gauld at btinternet.com
Mon Feb 19 18:00:58 CET 2007

"David Perlman" <dperlman at wisc.edu> wrote

> first.  In Unix at least, you'll be able to use either the command
> "route" or "routed" to manually change the routing table; ....
> I don't think the routing systems on  ordinary computers
> were designed with the idea in mind that you might
> want to use a specific link for a specific connection.

That's true, however....

> So the bottom line, I guess, is that a) this is a routing
> question,  not a python question; and b) it's not an easy
> question.  :)

Only because its so rarely done.
After a bit of digging it seems that socket.bind() can be
used on the client side as well as on the server side.
Thus if you really do want to limit your connections
you can tell the socket which interface to use.
You need to know the IP address of the interface
of course.

Caveat: I've never done this, nor even seen it done.
But the book Python Network Programming by Goerzen
specifically says its possible, although even it doesn't
give an example...


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list