Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetMQ resolves a hostname to IP for Options.LastEndpoint, but cannot reconnect to IP because original connection was to hostname #932

Open
fowie opened this issue Sep 4, 2020 · 1 comment
Labels

Comments

@fowie
Copy link

fowie commented Sep 4, 2020

socket.Options.LastEndpoint does not always contain the actual last endpoint of a socket. LastEndpoint appears to contain the resolved uri of an endpoint, even if a hostname was originally used in the socket.connect call. This makes it so that socket.disconnect(socket.Options.LastEndpoint) does not work with hostnames, because the internal zeroMQ socket was not connected with the resolved URI, but with the hostname URI.

Environment

NetMQ Version:    4.0.0.207
Operating System:  Windows 10
.NET Version:     net472

Expected behaviour

socket.Options.LastEndpoint should contain the actual Uri used in the Connect string
socket.Disconnect should not fail to disconnect from socket.Options.LastEndpoint

Actual behaviour

socket.Options.LastEndpoint contains the resolved IP address from c:\windows\system32\drivers\etc\hosts, and attempts to call socket.Disconnect(socket.Options.LastEndpoint) cause a NetMQ EndpointNotFoundException

Steps to reproduce the behaviour

Create a socket using the form
socket.Connect("tcp://HOSTNAME:PORT");
where HOSTNAME is a hostname, not an IP address. In my case HOSTNAME is defined in c:\windows\system32\drivers\etc\hosts:
192.168.1.66 nano-000
Once created, socket.Options.LastEndpoint will show: "tcp://192.168.1.66:PORT", not the hostname.
Attempt to disconnect from the endpoint using:
socket.Disconnect(socket.Options.LastEndpoint)

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had activity for 365 days. It will be closed if no further activity occurs within 56 days. Thank you for your contributions.

@stale stale bot added the stale label Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant