Override for MqttClient.Connect does not work when explicitly passing null username and password

88 views
Skip to first unread message

bob

unread,
Mar 21, 2019, 12:25:39 PM3/21/19
to MQTT
In theory, there should be no difference between the two calls below:

MqttClient.Connect(ApiClientId)

MqttClient.Connect(ApiClientId, null, null)

however the first call can successfully establish a connection, the second call cannot and produces the following logs:
[Information] MQTT Client lost connection. Attempting to re-establish connection...
[Error] Exception connecting to the MQTT endpoint
uPLibrary.Networking.M2Mqtt.Exceptions.MqttConnectionException: Exception connecting to the broker ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: An operation was attempted on something that is not a socket [sensitive text here]
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
   at uPLibrary.Networking.M2Mqtt.MqttNetworkChannel.Connect()
   at uPLibrary.Networking.M2Mqtt.MqttClient.Connect(String clientId, String username, String password, Boolean willRetain, Byte willQosLevel, Boolean willFlag, String willTopic, String willMessage, Boolean cleanSession, UInt16 keepAlivePeriod)
   --- End of inner exception stack trace ---
   at uPLibrary.Networking.M2Mqtt.MqttClient.Connect(String clientId, String username, String password, Boolean willRetain, Byte willQosLevel, Boolean willFlag, String willTopic, String willMessage, Boolean cleanSession, UInt16 keepAlivePeriod)


I was wondering why this happens.

Thank you.
Reply all
Reply to author
Forward
0 new messages