Hi,
i get mqtt from Nuget and write the following snippet:
public static void Main()
{
const string brokerIP = "192.168.0.25";
var x = IPAddress.Parse(brokerIP);
MqttClient client = new MqttClient(IPAddress.Parse(brokerIP));
client.MqttMsgPublished +=client_MqttMsgPublished;
client.MqttMsgSubscribed +=client_MqttMsgSubscribed;
client.MqttMsgPublishReceived += client_MqttMsgPublishReceived;
string clientId = Guid.NewGuid().ToString();
Debug.Print("1");
try
{
client.Connect(clientId);
}
catch (Exception e)
{
Debug.Print(e.InnerException.Message);
//throw;
}
finally
{
Debug.Print("finally");
client.Disconnect();
}
Debug.Print("2");
var str = "Hi peter";
for (;
{
client.Publish("/home/temperature", Encoding.UTF8.GetBytes(str));
}
}
Problem:
after Debug.Print("1")
client.Connect();
i get the following error message:
1
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
A first chance exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttConnectionException' occurred in M2Mqtt.dll
Exception was thrown: System.Net.Sockets.SocketException
finally
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
A first chance exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' occurred in M2Mqtt.dll
An unhandled exception of type 'uPLibrary.Networking.M2Mqtt.Exceptions.MqttCommunicationException' occurred in M2Mqtt.dll
Uncaught exception
The thread '<No Name>' (0x1) has exited with code 0 (0x0).
Done.
Any Idea????
Thanks in advance
Peter