7 Replies Latest reply on Sep 15, 2016 2:20 PM by ttielebein RSS
    gherr-2 Newbie

    Connection Error using Basic Thing with Property

    Hi all,

     

    I am running ThingWorx on localhost using Apache Tomcat 8.0. I have modified the config.json file with IP Address  as 'localhost'. This is how the link to my ThingWorx webpage looks like : http://localhost/Thingworx/Composer/index.html. When I am trying to run the example # 3, I am unable to create the connection. Following are the logs:

     

    SELECTED: Basic Thing with Property

    Running Example #3: minimal agent w/ property

    [Error] Error intializing socket connection.  Err = 111

    [Error] twWs_Connect: Error restarting socket.  Error 111

    [Error] twMessage_Send: Error sending Message with RequestId 1

    [Error] [HomeLight0]: Error calling twApi_WriteProperty() for LightLocation - 1107

    [Error] Error intializing socket connection.  Err = 111

    [Error] twWs_Connect: Error restarting socket.  Error 111

    [Error] twMessage_Send: Error sending Message with RequestId 2

    [Error] [HomeLight0]: Error calling twApi_PushProperties() - 1107

    [Error] Error connecting - 1001

     

    Could you please help? TIA!

      • Re: Connection Error using Basic Thing with Property
        ttielebein Collaborator

        Can you please post the rest of your config.json file contents here so I can look at it?

         

        Thanks!

        Tori

          • Re: Connection Error using Basic Thing with Property
            gherr-2 Newbie

            Thank you Tori for your reply. CJ.PNG

             

            Also, I have checked the ports opened on my Rpi using netstat -tln: It is listening only on port 22 and not 80. I am not sure if this makes a difference  or not.

              • Re: Connection Error using Basic Thing with Property
                ttielebein Collaborator

                Well, if you are connecting to ThingWorx with the provided URL above (http://localhost/Thingworx/Composer/index.html), then you know that ThingWorx is running on port 80 (as none is specified and port 80 is the default for HTTP). So I don't think the comment about port 22 is entirely relevant. Might be worth a try just to swap those guys out since it is easy to check.

                 

                I don't think that "tls" is a valid parameter. If you are trying to set the encryption to false, I'd use:

                "ws_connection": {

                       "encryption": "none"

                }

                 

                If swapping that syntax out doesn't help, try adding:

                "certificates": {

                     "validate": false,

                     "allow_self_signed": true

                }

                 

                Let me know how this goes. For a full list of valid parameters for this file, see the config.json.complete file, which should have been included in your EMS download.

                  • Re: Connection Error using Basic Thing with Property
                    gherr-2 Newbie

                    Thank you Tori. I replaced localhost with the exact IP address of my local machine in the conf.json file and it worked! Really appreciate your help

                        • Re: Connection Error using Basic Thing with Property
                          pkumar-5 Newbie

                          Hi Tori,

                           

                          I am getting the following error when I try to do Rasberry Pi 2 example . I have same config.json where I placed the IP address of my Thingworx server.

                           

                           

                          {

                              "connection": {

                                  "host": "192.168.1.18",

                                  "port": 80,

                                  "app_key": "xxxxxxxxxxx"

                              },

                              "tls":{

                                  "encryption": false

                              }

                          }

                           

                           

                          SELECTED: Basic Thing with Property

                          Running Example #3: minimal agent w/ property

                          [Error] Error intializing socket connection.  Err = 113

                          [Error] twWs_Connect: Error restarting socket.  Error 113

                          [Error] twMessage_Send: Error sending Message with RequestId 1

                          [Error] [PKG_HomeLight0]: Error calling twApi_WriteProperty() for LightLocation - 1107

                          [Error] Error intializing socket connection.  Err = 113

                          [Error] twWs_Connect: Error restarting socket.  Error 113

                          [Error] twMessage_Send: Error sending Message with RequestId 2

                          [Error] [PKG_HomeLight0]: Error calling twApi_PushProperties() - 1107

                          [Error] Error connecting - 1001

                           

                          Any help is appreciated

                            • Re: Connection Error using Basic Thing with Property
                              ttielebein Collaborator

                              This file is not formatted properly. For a full list of formatting options, see config.json.complete. Here is what you are trying to do, I think:

                               

                              {

                                "ws_servers": [{

                                "host": IP_ADDRESS,

                                "port": 80

                                }],

                                "appKey": "b7341ad4-4069-401a-97b0-7bade159e54f",

                                "ws_connection": {

                                "encryption": "none"

                                },

                                "certificates": {

                                "validate": false,

                                "allow_self_signed": true

                                }

                              }