[erlang-questions] listen on multiple interfaces

Per Hedeland <>
Fri Dec 9 08:23:27 CET 2016


On 2016-12-09 07:50, Benoit Chesneau wrote:
> that will listen on all interfaces though. i'm looking for a way to listen
> on a set of interfaces in fact, sorry to not have been clear :)

Yes, that works fine, you just need to create a listen socket for each.
That's how sockets work, nothing to do with gen_tcp or Erlang. And to be
more precise, despite large amounts of text that would have you believe
otherwise, you can't listen on interfaces, only on IP addresses (an
interface may have many IP addresses configured, and except for the
wildcard case, you need a listen socket for each if you want them all -
and an interface may of course also have *no* IP addresses configured,
in which case you don't have anything to listen on for that interface).

--Per Hedeland


More information about the erlang-questions mailing list