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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

raspberry pi 4 connection error 111

DS_9742416
4-Participant

raspberry pi 4 connection error 111

Hi

Been scratching my head long enough. Can anyone offer guidance on the following error - Thank you

pi@raspberrypi:~/microserver $ sudo ./wsems
[FORCE] 2020-12-22 14:52:28,215 ./wsems: Initializing EMS ....
[FORCE] 2020-12-22 14:52:28,215 main: Using config file /home/pi/microserver/etc/config.json
[INFO ] 2020-12-22 14:52:28,215 ./wsems: Creating the WsEms proxy.
[INFO ] 2020-12-22 14:52:28,215 ./wsems: Starting HTTP Server.
[WARN ] 2020-12-22 14:52:28,215 Main: Encryption is disabled on HTTP Server.
[WARN ] 2020-12-22 14:52:28,215 Main: TLS Hostname Validation Is Disabled
[WARN ] 2020-12-22 14:52:28,215 Main: Authentication is disabled on the HTTP Server.
[INFO ] 2020-12-22 14:52:28,216 ./wsems: Initializing the ThingWorx REST interface.
[FORCE] 2020-12-22 14:52:28,216 httpServer: starting http server port=8080
[INFO ] 2020-12-22 14:52:28,216 wsEmsProxy::initialize: FIPS is disabled.
[INFO ] 2020-12-22 14:52:28,216 wsEmsProxy::initialize: Encryption is enabled on Web Socket connection.
[ERROR] 2020-12-22 14:52:28,216 httpserver: Server socket error: Address already in use [127.0.0.1:8080]
[ERROR] 2020-12-22 14:52:28,216 httpServer: unable to bind http server to port=8080, trying next port.
[ERROR] 2020-12-22 14:52:28,216 httpserver: Server socket error: Address already in use [127.0.0.1:8081]
[ERROR] 2020-12-22 14:52:28,216 httpServer: unable to bind http server to port=8081, trying next port.
[WARN ] 2020-12-22 14:52:28,217 SDK: SDK Version: 2.2.11
[WARN ] 2020-12-22 14:52:28,217 SDK: TLS Library: OpenSSL
[WARN ] 2020-12-22 14:52:28,217 SDK: TLS Library Version: 1.1.1c
[INFO ] 2020-12-22 14:52:28,225 WsProxy::initialize: EMS Version 5.4.9.1154
[INFO ] 2020-12-22 14:52:28,225 WsProxy::initialize: twApi singleton initialized
[WARN ] 2020-12-22 14:52:28,225 WsProxy::initialize: Certificate validation is disabled.
[INFO ] 2020-12-22 14:52:28,226 wsEmsProxy::initialize: Initialization complete!

localhost:8443-->[INFO ] 2020-12-22 14:52:28,227 ./wsems: Starting the connection.
[ERROR] 2020-12-22 14:52:36,987 SDK: twTlsClient_ConnectSession: Error initializing socket connection. Err = 111
[ERROR] 2020-12-22 14:52:36,987 SDK: twWs_Connect: Error restarting socket.  Error 111
[ERROR] 2020-12-22 14:52:41,990 SDK: twTlsClient_ConnectSession: Error initializing socket connection. Err = 111
[ERROR] 2020-12-22 14:52:41,990 SDK: twWs_Connect: Error restarting socket.  Error 111

config.json

{
        "ws_servers":   [{
                        "host": "localhost",
                        "port": 8443
                }],
        "appkey":       "7e5768b6-f6c9-4259-99c9-c8e1a2e73d39",
        "http_server":  {
                "host": "127.0.0.1",
                "port": 8080,
                "use_default_certificate":  true,
                "ssl":  false,
                "authenticate": false
        },
        "logger":       {
                "level": "INFO"
        },
        "certificates": {
                "validate": false,
                "disable_hostname_validation":  true
        }
}

 

1 ACCEPTED SOLUTION

Accepted Solutions

Are you able to follow the steps in the guide to connect to a free hosted trial instance?

 

is the EMS running on a different piece of hardware than the hardware where ThingWorx Foundation is running? If so, you will need to enter the IP address where ThingWorx Foundation is running into the config.json file of the EMS. 

View solution in original post

6 REPLIES 6

The log file shows that some process is already running on port 8080 and port 8081. Do you have more than one instance of the EMS running already?

 

Do you have ThingeWorx Foundation running on this same machine? What happens when you browse to:

https://localhost:8443/Thingworx 

You should be able to browse to ThingWorx at the hostname and port where the EMS is trying to connect.

Can you connect to a free hosted trial of ThingWorx by following the directions in this guide:

https://developer.thingworx.com/en/resources/guides/thingworx-raspberry-pi-quickstart

 

 

 

Thank you for the quick response.

 

No I don't believe I have another instance of EMS already running - will check though.

 

I have ThingWorx Foundation running on a separate laptop. When I browse to: https:localhost:8443/Thingworx it takes me to https://localhost:8443/Thingworx/Composer/index.html#/modeler/browse/Project

I am following the Raspberry Pi quick guide although trying to connect to local host rather than ThingWorx hosted trial.

Hi @DS_9742416 ,

 

Have you checked the port using any tool. The port number should be in openstate.

If host/port is blocked then if it is iptables as the firewall then you need to add a rule to allow the connection.

Are you able to connect unsecured ?

Maybe you need to set 

 

"ws_connection": {

"encryption": "SSL",

"verbose": true,

"msg_timeout": 1000

},

 

Hope it helps,

Thank you for your assistance... I am a small step forwards in that I have no error message for port 8080 so I guess I did have more than one instance of EMS open.

 

I set the rules to allow access to the port 8443 and added the additional content to the config.json file but still getting the same error

pi@raspberrypi:~ $ cd microserver
pi@raspberrypi:~/microserver $ ls -la
total 5104
drwxr-xr-x  5 pi pi    4096 Dec 21 13:41 .
drwxr-xr-x 18 pi pi    4096 Dec 22 18:06 ..
drwxr-xr-x  4 pi pi    4096 Dec 21 13:41 doc
drwxr-xr-x  5 pi pi    4096 Dec 23 10:08 etc
drwxr-xr-x  2 pi pi    4096 Dec 21 13:41 install_services
-rw-r--r--  1 pi pi 2616813 May 28  2020 libcrypto.so.1.1
-rw-r--r--  1 pi pi  554036 May 28  2020 libssl.so.1.1
-rwxr-xr-x  1 pi pi 1067364 May 28  2020 luaScriptResource
-rwxrwxr-x  1 pi pi  962200 May 28  2020 wsems
pi@raspberrypi:~/microserver $ sudo chmod 775 wsems
pi@raspberrypi:~/microserver $ sudo ./wsems
[WARN ] 2020-12-23 10:11:00,189 jsonConfigurator::addItem: Parent data_security not found.  Creating it
[ERROR] 2020-12-23 10:11:00,194 jsonConfigurator::setEncryptedString: Key or Parent cannot be null for call
[FORCE] 2020-12-23 10:11:00,197 ./wsems: Initializing EMS ....
[FORCE] 2020-12-23 10:11:00,197 main: Using config file /home/pi/microserver/etc/config.json
[INFO ] 2020-12-23 10:11:00,197 ./wsems: Creating the WsEms proxy.
[INFO ] 2020-12-23 10:11:00,197 ./wsems: Starting HTTP Server.
[WARN ] 2020-12-23 10:11:00,197 Main: Encryption is disabled on HTTP Server.
[WARN ] 2020-12-23 10:11:00,197 Main: TLS Hostname Validation Is Disabled
[WARN ] 2020-12-23 10:11:00,197 Main: Authentication is disabled on the HTTP Server.
[INFO ] 2020-12-23 10:11:00,198 ./wsems: Initializing the ThingWorx REST interface.
[FORCE] 2020-12-23 10:11:00,198 httpServer: starting http server port=8080
[INFO ] 2020-12-23 10:11:00,198 wsEmsProxy::initialize: FIPS is disabled.
[INFO ] 2020-12-23 10:11:00,198 wsEmsProxy::initialize: Encryption is enabled on Web Socket connection.
[WARN ] 2020-12-23 10:11:00,199 SDK: SDK Version: 2.2.11
[WARN ] 2020-12-23 10:11:00,200 SDK: TLS Library: OpenSSL
[WARN ] 2020-12-23 10:11:00,207 SDK: TLS Library Version: 1.1.1c
[INFO ] 2020-12-23 10:11:00,240 WsProxy::initialize: EMS Version 5.4.9.1154
[INFO ] 2020-12-23 10:11:00,240 WsProxy::initialize: twApi singleton initialized
[WARN ] 2020-12-23 10:11:00,240 WsProxy::initialize: Certificate validation is disabled.
[INFO ] 2020-12-23 10:11:00,241 wsEmsProxy::initialize: Initialization complete!
[INFO ] 2020-12-23 10:11:00,242 ./wsems: Starting the connection.

localhost:8443-->[ERROR] 2020-12-23 10:11:02,937 SDK: twTlsClient_ConnectSession: Error initializing socket connection. Err = 111
[ERROR] 2020-12-23 10:11:02,937 SDK: twWs_Connect: Error restarting socket.  Error 111
[ERROR] 2020-12-23 10:11:07,940 SDK: twTlsClient_ConnectSession: Error initializing socket connection. Err = 111

 

Are you able to follow the steps in the guide to connect to a free hosted trial instance?

 

is the EMS running on a different piece of hardware than the hardware where ThingWorx Foundation is running? If so, you will need to enter the IP address where ThingWorx Foundation is running into the config.json file of the EMS. 

Thank you Rick! That was it. ThingWorx Foundation is running on a device from the EMS so yes adding the correct IP address fixed the issue

 

Top Tags