-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Linux - when Upgrading from version 4.3.3.952 to 4.3.4.1084 the client always raises the exception «None of the discovered or specified addresses match the socket address family» #1997
Comments
@daframax Are you using an DNS host address in the WithTcpServer method or an IP address (as string)? |
Hello @chkr1011, Regarding your question: I pass the host as string and the port as int. |
@daframax Please try this version from mygetfeed and let me know if it works: https://www.myget.org/feed/mqttnet/package/nuget/MQTTnet/4.3.4.1116 |
Thank you @chkr1011 I will try it and let you know as soon as possibile |
I figured out that the issue is related to Mono. It handles the DnsEndpoint differently than .NET Framework does. When using the overload with host and port it works perfectly. Build: 4.3.4.1133 contains the fix if you want to test. I will add a workaround for that and release a new version soon. |
Hello @chkr1011 Thank you for your time. Method socket.ConnectAsync(string host, int port) uses: public IAsyncResult BeginConnect (string host, int port, AsyncCallback callback, object state)
{
ThrowIfDisposedAndClosed ();
if (host == null)
throw new ArgumentNullException ("host");
if (addressFamily != AddressFamily.InterNetwork && addressFamily != AddressFamily.InterNetworkV6)
throw new NotSupportedException ("This method is valid only for sockets in the InterNetwork and InterNetworkV6 families");
if (port <= 0 || port > 65535)
throw new ArgumentOutOfRangeException ("port", "Must be > 0 and < 65536");
if (is_listening)
throw new InvalidOperationException ();
var sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Connect) {
Port = port
};
var dnsRequest = Dns.GetHostAddressesAsync (host);
dnsRequest.ContinueWith (t => {
if (t.IsFaulted)
sockares.Complete (t.Exception.InnerException);
else if (t.IsCanceled)
sockares.Complete (new OperationCanceledException ());
else {
sockares.Addresses = t.Result;
BeginMConnect (sockares);
}
}, TaskScheduler.Default);
return sockares;
} Method socket.ConnectAsync(EndPoint endpoint) uses: public IAsyncResult BeginConnect (EndPoint remoteEP, AsyncCallback callback, object state)
{
ThrowIfDisposedAndClosed ();
if (remoteEP == null)
throw new ArgumentNullException ("remoteEP");
if (is_listening)
throw new InvalidOperationException ();
SocketAsyncResult sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Connect) {
EndPoint = remoteEP,
};
BeginSConnect (sockares);
return sockares;
} I will test the version 4.3.4.1133 Thank you |
Please test with the released 4.3.5 version. I experienced the same issue with one of my Android apps. So, I was able to fix it. |
Describe the bug
Using the latest version on Linux (Mono) the Client always raises the MqttCommunicationException with the message: None of the discovered or specified addresses match the socket address family when trying to connect to Remote EndPoint.
Using Version
4.3.3.952
works fine.Which component is your bug related to?
To Reproduce
Steps to reproduce the behavior:
v4.3.4.1084
.Expected behavior
The client connects to the Broker.
Additional context / logging
Note
No code provided as the issue is simply related to the ConnectAsync method.
The text was updated successfully, but these errors were encountered: