multiple interfaces

Peter-Henry Mander <>
Fri Aug 19 16:44:29 CEST 2005


Hi Serge,

I believe you may find prim_inet:connect/2 and /3 useful. It does the
same as Unix man 2 connect:
"If the socket is of type SOCK_DGRAM then the serv_addr address is the
address to which datagrams are sent by default, and the only address
from which datagrams are received."

connect(insock(), IP, Port) -> ok | {error, Reason}
connect(insock(), IP, Port, Timeout) -> ok | {error, Reason}

Pete.

On Fri, 2005-08-19 at 10:08 -0400, Serge Aleynikov wrote:
> Hi,
> 
> Is there a way to force the erlang distribution on a host with two 
> network interfaces to bind only to one IP?
> 
> I am trying to test how network partitioning is handled by my 
> application, and for this reason I'd like to ensure that a shut down of 
> a net interface used by Erlang doesn't kill my terminal session 
> connected through the second interface.
> 
> I'm hoping there is some {ip,IPAddress} configuration parameter similar 
> to the one in gen_tcp that can be given at startup, but I don't see 
> anything relevant in the documentation.
> 
> Thanks.
> 
> Serge
> 
-- 
"The Tao of Programming
 flows far away 
 and returns 
 on the wind of morning."






More information about the erlang-questions mailing list