[zeromq-dev] socket.connect to DNS name fails

Enoch Root enokhroot at yahoo.com
Thu Mar 17 04:28:14 CET 2016

Hi all,

I'm using the stock hwclient.cc example to test ZMQ.  In the following lines

std::cout << "Connecting to hello world server~@�" << std::endl;
socket.connect ("tcp://");

if I change the argument to "tcp://foo:23528", connection fails with the following error

Connecting to hello world server…
terminate called after throwing an instance of 'zmq::error_t'
what():  Invalid argument
Aborted (core dumped)

However, all other tools successfully resolve foo to the correct IP address:

root at 94ff8bb90728:# ping foo
PING foo ( 56(84) bytes of data.
64 bytes from foo.default ( icmp_seq=1 ttl=64 time=0.145 ms
64 bytes from foo.default ( icmp_seq=2 ttl=64 time=0.073 ms

Any clues what may be wrong?  Also, how does socket.connect resolve its argument if it is a DNS name?


More information about the zeromq-dev mailing list