Hi,
I’m trying the Paho Client for .NET (more specific .NET MF v4.2) with a Netduino Plus.
I get the following errors:
first chance exception of type 'System.ArgumentException' occurred in System.dll
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll
Microsoft.SPOT.Net.SocketNative::getaddrinfo
System.Net.Dns::GetHostEntry
uPLibrary.Networking.M2Mqtt.MqttNetworkChannel::.ctor
uPLibrary.Networking.M2Mqtt.MqttClient::Init
uPLibrary.Networking.M2Mqtt.MqttClient::.ctor
uPLibrary.Networking.M2Mqtt.MqttClient::.ctor
MQTTSample.Program::PublishMessage
MQTTSample.Program::Main
Code snippet (example from the PAHO site), method called from Main:
private static void PublishMessage(int value)
{
// create client instance
try
{
MqttClient client = new MqttClient("198.41.30.241:1883"); // iot.eclipse.org
string clientId = Guid.NewGuid().ToString();
client.Connect(clientId);
string strValue = value.ToString();
// publish a message on "/home/temperature" topic with QoS 2
client.Publish("/home/temperature", Encoding.UTF8.GetBytes(strValue), MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE, false);
}
catch(Exception e)
{
Debug.Print(e.StackTrace);
}
}
Thanks.
Guy