Mono IPv6 Issues
See original GitHub issueHello!
MQTTnet under mono seems to have an issue with an environment that lacks IPv6 - for instance, by passing ipv6.disable=1 as kernel parameter.
First, when starting an MQTTnet server, the server will not start unless BoundInterNetworkV6Address is explicitly set to IPAddress.None when building the MQTT server options with MqttServerOptions. This workaround suffices to make MQTTnet listen only on the IPv4 address - otherwise, the server will not start and will fail with the exception error:
An address incompatible with the requested protocol was used
Unfortunately, for the MQTTnet client part, I have not found a workaround and if the OS lacks IPv6 support, then the MQTTnet client will fail to connect with the same error.
I am unsure whether this issue pertains more to mono rather than MQTTnet but could the MQTTnet client implementation expose a way to set the IPv6 endpoint so it can be set to IPAddress.None such that the same workaround could be applied?
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:8

Top Related StackOverflow Question
Please try to implement your own channel factory and pass it in the constructor of the MqttClient. There you can return a channel which is NOT depending on a dual mode socket (which might be only supported in .net). Another solution might me moving to .net core instead of mono.
Ah sorry. It is not there. It is in the TCP options. The problem is that these are not exposed to the builder yet. So you have to parse them to TcpOptions after using the builder or create them without the builder. I will fix that for the next version.