[zeromq-dev] bind on localhost fails

Martin Sustrik sustrik at 250bpm.com
Sat Feb 27 21:25:19 CET 2010

Hi Gonzalo,

> This is weird, and it might be a bug. I have localhost in my hosts file
> (WinXP) defined as
> If I create a PUB socket and try to bind it to tcp://localhost:27000, it
> fails (maybe in the name resolution). But if I bind it to
> tcp://, it works.
> On the other hand, I can connect that socket to either
> tcp://localhost:27000 or tcp:// Both work ok.

You should distiguish between "network interface names" and "host names".

Network interface names are local to the machine. Say, on Linux, they 
are lo (loopback), eth0 (first ethernet interface) etc. Unfortunately, 
Windows has no sane interface names. The names used are extremely long 
and complex and completely unsuitable for quick referral to a NIC. Thus, 
on Windows you have to refer to network interfaces using IP number.

Host names are global names identifying individual boxes 
(myserver.mycompany.com). These are standardised and resolved in the 
same manner on all operating systems.

Bind binds the socket to local network interface.

Connect connects the socket to a remote host.

Makes sense?


More information about the zeromq-dev mailing list