On 3/29/2010 9:26 PM, John Yuan wrote:
> Hi,
>
>  I may shooting a wrong question, but I saw the same question here that
> left unanswered and gone 60 days more, so I want to raise it once again.
>
>  I have 3 NIFs :
>
>   1. PPP1 (111.111.111.111):PPTP to VPN
>  2. eth2 (192.168.0.2)  :LAN
>  3. ppp3 (333.333.333.333):PPPoE to ASDL
>
>  and want to bind a specific interface to Mechanize agent somehow like :
>
>   agent.bind(Socket.sockaddr_in(80, "111.111.111.111"))
>  agent.bind(Socket.sockaddr_in(80, "192.168.0.2"))
>  agent.bind(Socket.sockaddr_in(80, "333.333.333.333"))
>
> like the way Socket does. But I haven't have any luck yet.
>
> Did anyone try yet or shouldn't expect Mechanize package working in this
> way?
>
> any suggestion would be appreciated !!
>
> Thanks
>
> John
>   
It doesn't work that way.  Mechanize is a client, not a server.  The NIC
used is decided by the destination IP and the routes in your Operating
System. Only server sockets can be bound to one or more IPs.