7 Replies Latest reply on Apr 5, 2016 1:32 PM by aanjan RSS
    gseq Apprentice

    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

      • Re: Latest C-SDK Version - Error creating BSD socket to be used for the websocket
        aanjan Heavyweight Champ

        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?

          • Re: Latest C-SDK Version - Error creating BSD socket to be used for the websocket
            gseq Apprentice

            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?

              • Re: Latest C-SDK Version - Error creating BSD socket to be used for the websocket
                aanjan Heavyweight Champ

                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.

                  • Re: Latest C-SDK Version - Error creating BSD socket to be used for the websocket
                    gseq Apprentice

                    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