zeromq / chumak

Pure Erlang implementation of ZeroMQ Message Transport Protocol.
Mozilla Public License 2.0
197 stars 47 forks source link

Support "*" hostname to bind to all network interfaces #41

Closed eshurakov closed 3 years ago

eshurakov commented 3 years ago

This PR adds the ability to listen on all interfaces.

Addr which is passed to gen_tcp:listen can be one of:

socket_address() = 
    ip_address() | any | loopback | local_address()

In this PR I'm converting "*" hostname to any, which is then passed to gen_tcp:listen and makes it to listen on all interfaces.

Example:

{ok, Socket} = chumak:socket(router),
{ok, Peer} = chumak:bind(Socket, tcp, "*", 4000)