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

Enoch Root enokhroot at yahoo.com
Fri Mar 18 21:23:47 CET 2016


So this turned out to be a Docker issue.  My actual hostname wasn't "foo" but "foo_1".  It is the hostname generated by Docker Compose and zmq rightly complained since "_" is not valid in a hostname.


----- Original Message -----
From: Enoch Root <enokhroot at yahoo.com>
To: "zeromq-dev at lists.zeromq.org" <zeromq-dev at lists.zeromq.org>
Sent: Wednesday, March 16, 2016 11:28 PM
Subject: socket.connect to DNS name fails

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://172.18.0.5:23528");


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 (172.18.0.5) 56(84) bytes of data.
64 bytes from foo.default (172.18.0.5): icmp_seq=1 ttl=64 time=0.145 ms
64 bytes from foo.default (172.18.0.5): icmp_seq=2 ttl=64 time=0.073 ms
^C


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

Thanks!



More information about the zeromq-dev mailing list