Mackhdo
Mackhdo

Reputation: 110

SocketException after publishCommand, ApplicationClient

I have created an application in the IBM Watson IoT Platform, and I used the code sample provided to connect an ApplicationClient object.

The connection is fine, but when the publish command is sent, after a second or two I got this in the output window of VS2017:

Exception levée : 'System.Net.Sockets.SocketException' dans System.dll
Exception levée : 'System.IO.IOException' dans System.dll
Exception levée : 'System.IO.IOException' dans System.dll
Le thread 0x4a4 s'est arrêté avec le code 0 (0x0).
Exception levée : 'System.Security.Cryptography.CryptographicException' 
dans mscorlib.dll

the thing is, I have used try/catch block everywhere, but they don't catch those exceptions.

I can guess it's about ports forwarding but even after opening the ports required by watson iot, I can't seem to have the command working

I can successfully publish events from device and reception those events on an ApplicationClient, I only have problems with Command.

EDIT: add clarification

connevtionState = mqttClient.Connect(clientId, clientUsername, clientPassword,cleanSession,keepAlivePeriod);

Upvotes: 1

Views: 156

Answers (2)

Mackhdo
Mackhdo

Reputation: 110

Ok, i found why...and i'm ashamed. I have affected the wrong profile on the application, i couldn't send command with this profile. I have set a standard application profile and now everything works fine. I wasted too many hours on this...

Upvotes: 0

Ben Bakowski
Ben Bakowski

Reputation: 103

Dropped connections can indicate you're trying to do something illegal, such as publishing to a topic you're not allowed to.

Upvotes: 0

Related Questions