Giter Site home page Giter Site logo

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» about mqttnet HOT 7 CLOSED

daframax avatar daframax commented on June 16, 2024
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»

from mqttnet.

Comments (7)

daframax avatar daframax commented on June 16, 2024 1

Hello @chkr1011,
First of all thank you for the library: it is a great work.
I started using it from version 3.x

Regarding your question: I pass the host as string and the port as int.

from mqttnet.

chkr1011 avatar chkr1011 commented on June 16, 2024 1

@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

from mqttnet.

chkr1011 avatar chkr1011 commented on June 16, 2024

@daframax Are you using an DNS host address in the WithTcpServer method or an IP address (as string)?

from mqttnet.

daframax avatar daframax commented on June 16, 2024

Thank you @chkr1011 I will try it and let you know as soon as possibile

from mqttnet.

chkr1011 avatar chkr1011 commented on June 16, 2024

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.

from mqttnet.

daframax avatar daframax commented on June 16, 2024

Hello @chkr1011 Thank you for your time.
I was about to report the same thing after testing the version 4.3.4.1116.
I noticed that one of differences between version 4.3.3.952 and 4.3.4.1084 was the ctor into the class CrossPlatformSocket. So I check the source code of the implementation of the class Socket.cs inside the mono repo on github and I noticed that there are differences:

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

from mqttnet.

chkr1011 avatar chkr1011 commented on June 16, 2024

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.

from mqttnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.