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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Latest C-SDK Version - Error creating BSD socket to be used for the websocket

gseq
7-Bedrock

Latest C-SDK Version - Error creating BSD socket to be used for the websocket

We have a deployed Thingworx server on a Linode, running TW 6.0.3 with a certificate installed.

I've downloaded the latest C-SDK from the marketplace version 1-3-1-957 which also was supposed to solve the BSD bug:

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS227278&lang=en&source=snippet

However, I still keep getting it. Any ideas on what is going on?. The Edge is a uClinux machine.

root:/> Starting ThingWorx ...

[FORCE] 2016-04-04 21:12:15,217: Starting up

[DEBUG] 2016-04-04 21:12:15,218: twWs_Create: Initializing Websocket Client for https://xxxxxxxxxxxxxxxxx:443//Thingworx/WS

[DEBUG] 2016-04-04 21:12:15,218: twTlsClient_Create: Initializing TLS Client

[DEBUG] 2016-04-04 21:12:15,992: twTlsClient_Close: Disconnecting from server

[ERROR] 2016-04-04 21:12:15,993: twWs_Create: Error creating BSD socket to be used for the websocket

[ERROR] 2016-04-04 21:12:15,993: twApi_Initialize: Error creating websocket structure, retrying

[DEBUG] 2016-04-04 21:12:20,997: twWs_Create: Initializing Websocket Client for https://xxxxxxxxxxxxxxx:443//Thingworx/WS

[DEBUG] 2016-04-04 21:12:20,997: twTlsClient_Create: Initializing TLS Client

[DEBUG] 2016-04-04 21:12:22,789: twTlsClient_Close: Disconnecting from server

[ERROR] 2016-04-04 21:12:22,789: twWs_Create: Error creating BSD socket to be used for the websocket

[ERROR] 2016-04-04 21:12:22,789: twApi_Initialize: Error creating websocket structure, retrying

[DEBUG] 2016-04-04 21:12:27,792: twWs_Create: Initializing Websocket Client for https://xxxxxxxxxxxxxxxx:443//Thingworx/WS

[DEBUG] 2016-04-04 21:12:27,792: twTlsClient_Create: Initializing TLS Client

[DEBUG] 2016-04-04 21:12:29,340: twTlsClient_Close: Disconnecting from server

[ERROR] 2016-04-04 21:12:29,340: twWs_Create: Error creating BSD socket to be used for the websocket

[ERROR] 2016-04-04 21:12:29,340: twApi_Initialize: Error creating websocket structure, retrying

root:/> [DEBUG] 2016-04-04 21:12:34,344: twWs_Create: Initializing Websocket Client for https://xxxxxxxxxxxxxxxxx:443//Thingworx/WS

[DEBUG] 2016-04-04 21:12:34,344: twTlsClient_Create: Initializing TLS Client

[DEBUG] 2016-04-04 21:12:35,547: twTlsClient_Close: Disconnecting from server

[ERROR] 2016-04-04 21:12:35,547: twWs_Create: Error creating BSD socket to be used for the websocket

[ERROR] 2016-04-04 21:12:35,547: twApi_Initialize: Could not connect after 3 attempts

7 REPLIES 7
Aanjan
12-Amethyst
(To:gseq)

Gerard, is there a proxy server in place? Or are the connections going through a specific firewall? Would it be possible for you to check if they support websockets or not?

gseq
7-Bedrock
(To:Aanjan)

I'll have to check with the server admin.

I can connect to a  local TW server(without TLS) fine.

EMS is not a pre-requisite, correct?

Aanjan
12-Amethyst
(To:gseq)

If it works correctly with a local connection, but doesn't externally, we would need to check your network settings, mainly around firewall type or proxy involved. The BSD socket error is more or less generic, so we can't exactly pinpoint on where the issue could be, but checking the network settings would be a great starting point.

I didn't get your prerequisite point though - you can use either the EMS or the C SDK to connect.

gseq
7-Bedrock
(To:Aanjan)

I changed TW_HOST from https//mywebsite.com to mywebsite.com, and am able to go a little further until I get a 500 error(although the server is online). Continuing to debug, unless you have any suggestions. I still have to hear back on the firewall issue.

Thingwors is installed under mywebsite.com/Thingworx.

[FORCE] 2016-04-05 11:50:15,226: Starting up

[DEBUG] 2016-04-05 11:50:15,226: twWs_Create: Initializing Websocket Client for mywebsite.com:443//Thingworx/WS

[DEBUG] 2016-04-05 11:50:15,226: twTlsClient_Create: Initializing TLS Client

[DEBUG] 2016-04-05 11:50:15,960: twApi_Initialize: Websocket Established after 0 tries

[DEBUG] 2016-04-05 11:50:15,961: subscribedPropsMgr_Initialize: Initializing subscribed properties manager

[TRACE] 2016-04-05 11:50:15,962: twApi_Connect: Delaying 0 milliseconds before connecting

[DEBUG] 2016-04-05 11:50:15,965: twTlsClient_Reconnect: Re-establishing SSL context

[DEBUG] 2016-04-05 11:50:16,343: twTlsClient_Connect: Connecting to server

[DEBUG] 2016-04-05 11:50:17,80: twTlsClient_Connect: TLS connection established

[TRACE] 2016-04-05 11:50:17,83: twWs_Connect: Connected to mywebsite.com:443

[TRACE] 2016-04-05 11:50:17,83: twWs_Connect: Sent request:

GET /Thingworx/WS HTTP/1.1

User-Agent: ThingWorx C SDK

Upgrade: websocket

Connection: Upgrade

Host: mywebsite.com

Sec-WebSocket-Version: 13

Sec-WebSocket-Key: [REMOVED]

Max-Frame-Size: 8192

appKey: [REMOVED]

[TRACE] 2016-04-05 11:50:17,174: twTlsClient_Read: Read: 309, Asked for: 8192

[TRACE] 2016-04-05 11:50:17,174: twWs_Connect: Got Response from Server:

HTTP/1.1 500 Internal Server Error

Date: Tue, 05 Apr 2016 15:50:48 GMT

Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips

Upgrade: websocket

Connection: upgrade, close

Sec-WebSocket-Accept: [REMOVED]

Content-Type: text/html;charset=utf-8

Content-Language: en

Content-Length: 2070

[ERROR] 2016-04-05 11:50:17,175: twWs_Connect: Error initializing web socket.  Response code: 500

Aanjan
12-Amethyst
(To:gseq)

Ah, I was wondering about proxy because you would need to provide proxy info (unless a reverse proxy is in place). Would it be possible for you to test the same with an EMS? Make sure to set logger level to TRACE, so that we can get the complete flow. Here's an example snippet -

"logger":    {
   "level":    "TRACE",
   "auto_flush":    true,
   "publish_directory":    "/_tw_logs/",
   "publish_level":    "TRACE",
   "max_file_storage":    2000000

    },

gseq
7-Bedrock
(To:Aanjan)

I doubt we will be able to run the EMS. Our platform is on an ADI Blackfin processor and there is no EMS release for that architecture.

Aanjan
12-Amethyst
(To:gseq)

Since we are still waiting on the firewall information, would you be able to connect to your server from an outside network? I suppose you have some form of a mobile network on your device, through which you are trying to connect to your device. I was hoping we could maybe run the EMS on a computer at a different network and connect to a Remote Thing on your server.

Announcements


Top Tags