Open jeremyandrews opened 4 years ago
And netstat
showing that indeed it's incorrectly creating an IPv6 socket:
$ netstat -an | grep 1234
tcp6 0 0 127.0.0.1:1234 :::* LISTEN
Currently its not supported, but it should be straight forward to add, a PR would be most welcomed.
By default the context enables the IPv6 features which probably forces a v6 socket to be created even with a v4 address. So I'm assuming allowing the user to modify the following line would work:
I think the best approach would be to add a new force_ipv4
(or a better name) method to the CtxBuilder
to toggle this option.
Yeah pretty sure this would work, after reading the zmq API doc:
The ZMQ_IPV6 argument sets the IPv6 value for all sockets created in the context from this point onwards. A value of 1 means IPv6 is enabled, while 0 means the socket will use only IPv4. When IPv6 is enabled, a socket will connect to, or accept connections from, both IPv4 and IPv6 hosts.
(Taken from http://api.zeromq.org/master:zmq-ctx-set)
Ah, I see. So it is creating an IPv4 socket, it's just creating an IPv6 socket as well.
It seems my problem is different than I thought, then -- recv_msg()
isn't returning anything even when a client connects to the socket (or I telnet to the socket), and thus hanging forever.
It seems my problem is different than I thought, then -- recv_msg() isn't returning anything even when a client connects to the socket (or I telnet to the socket), and thus hanging forever.
The Server
does not receive a notification when a new client gets connected, only when it sends a new message.
All attempts to bind to an address are creating an IPv6 socket instead of the desired IPv4 socket.
For example:
Results in the following output:
Using my actual IP address instead of 0.0.0.0 has the same general problem:
I saw some examples that specify the interface, for example:
But this results in a panic:
The backtrace:
I assume I'm doing something wrong, any help would be greatly appreciated.
If helpful, the actual code where I'm trying to implement this can be viewed here: https://github.com/jeremyandrews/goose/blob/gaggle/src/manager.rs
And I'm running with the following command:
I'm compiling on Linux in an Ubuntu-based distribution (PopOS). Here's my interfaces: