cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem connecting C SDK to Thingworx composer

Highlighted
Level 1

Problem connecting C SDK to Thingworx composer

Hi,

I am trying the SteamSensor example available in the C SDK folder. But on finally running the exe file I get the following error:

developer portal.png

I am using the 30 day trial online composer whose address is : https://pp-180103xxxxxx.devportal.ptc.io/Thingworx/Composer/index.html

In the main.c file I set:

#define TW_HOST "pp-180103xxxxxx.devportal.ptc.io"

#define TW_APP_KEY "18ecb3d9-xxxx-yyyy-zzzz-ab6b29dc21a8"

What could be the problem? Any help is appreciated

Tags (1)
17 REPLIES 17

Re: Problem connecting C SDK to Thingworx composer

Hi Amit, are you attempting to create secured websocket connection with WSS or insecured with WS?

Re: Problem connecting C SDK to Thingworx composer

Hi Sushant,

How do I check that?

I am not using #define NO_TLS in the main.c file. So port no should be 443. Has it got something to do with that?

I am sorry. I am new to this field and was just following the steps mentioned in the tutorial. (https://developer.thingworx.com/resources/guides/thingworx-c-sdk-setup-guide/connection-test-setup)

Re: Problem connecting C SDK to Thingworx composer

The error in the command prompt is highlighting issues with creating SSL connection, it seems to be using the 443 which inherently points to the secured websocket. I've not tried this online guide, will check if there's anything that can be configured there, but could you check if there's any possibility that the pc from which you are executing this piece of code is not blocking e.g. firewall or some anti virus this SSL connection to ThingWorx server.

Re: Problem connecting C SDK to Thingworx composer

I turned off the Windows Firewall on my system. It didn't work but the error log changed slightly.

The error now reads: "Error initialising socket connection" instead of "Error initialising SSL connection".

developer portal.png

Re: Problem connecting C SDK to Thingworx composer

Hmm.. interesting. So if I use the link that you have shared in your above response and if you check the Troubleshooting section the error you are receiving (which has error code of 201) seems to require users to check the websocket configuration. Some questions about your setup

1. What sort of machine are you working with, from screenshot looks like Win7, is that right?

2. How are you connected to the network? via LAN or WiFi?

Re: Problem connecting C SDK to Thingworx composer

Yes it's a Windows 7 machine. I am currently using WiFi for connecting to the network.

.

Re: Problem connecting C SDK to Thingworx composer

Somehow I feel this kind of relates to the network adaptor, (I could be wrong though but it's worth checking) . Could you give this a try How to fix failed Windows sockets initialization? - Microsoft Community it basically points to use the Window's NetShell utility for resetting the see this:  TCP/IP How to reset TCP/IP by using the NetShell utility

Re: Problem connecting C SDK to Thingworx composer

So I tried the above mentioned steps and it doesn't work. Instead it again started giving the previous error: "Error initialising SSL connection" as mentioned in the original post.

I also tried another Windows 7 system with a LAN connection but it still gives the same error.

Re: Problem connecting C SDK to Thingworx composer

Is there anything more which I can try to make it work?