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

Socket error occurred connecting [to RaspberryPi]

aldob1
2-Explorer

Socket error occurred connecting [to RaspberryPi]

Source: Modbus TCP/IP Ethernet

Event: Channel1.Device1 | Socket error occurred connecting. | Error = 10061, Details = 'No connection could be made because the target machine actively refused it.'.

 

Has anyone ran into this issue when connecting the Raspberry Pi to KEPServerEX?

 

As far as I understand, all I have to do to connect is:

1) format the memory card

2) write SigmaTile Pixel disk image

3) put the SD card in Pi

4) get Pi on the same network as everything else

5) update Pi from GitHub just to make sure I have the latest code

6) load the SigmaTile_SenseHat.opf in KEPServerEX

7) Change Channel1 "ID" to show the Pi's IP Address.

 

Am I missing something?

6 REPLIES 6

Can you check whether firewall is blocking??

Thanks,

Varathan

stmarchessault
14-Alexandrite
(To:aldob1)

Hello Aldo,

This error reported by the KEPServerEX Modbus TCP driver comes from Winsock. It reveals that the TCP/IP connection attempt was made to a valid IP address and Port, except the destination device (the Raspberry Pi, in this case) actively blocked the attempt to form a socket. Most often, this occurs when the port is already occupied by another TCP session.

What is the port you are trying to connect with? If you did not manually set this in the KEPServerEX Configuration, it will be set to the default Modbus port (502).


Can you confirm the Raspberry Pi will accept a connection at this port, and there are currently no other applications connecting to the same port?

Best regards,

Steven Marchessault

Technical Support Engineer | Kepware Technologies

aldob1
2-Explorer
(To:aldob1)

Steven and Varathan, thank you for the replies.

Actually, it turned out that the SenseHat being physically on the Raspberry Pi was required for it to connect. (I purchased it after RPi)

I am new to KEPServerEX... I wrongly assumed that the Raspberry Pi being the "brains", it would connect successfully and simply show that the Input/Output devices (SenseHat's sensors) it was expecting to see were not actually present.

Perhaps it is simply the way this particular project was set up. I have yet to dig into the Python code in the Tile folders and such.

Thank you again for the replies and suggestions,

Aldo

mthakker
12-Amethyst
(To:aldob1)

Hey Aldo,

I wrote the code for the Sigma Tile and you're right - the MODBUS server on the Pi doesn't start up until it acquires data in some way - whether by the default Sense Hat code, or customized for a different set of sensors.  There is almost no error handling or trapping in the code - only a loop if there's no internet connection.

Thanks,

Milan

Aldo,

I don't believe the python code is robust enough to handle all error conditions. All our testing was with SenseHat connected since we were getting reading from it.  You should able to add some some debugging statements to Python script and try. Having said that error is misleading but debug statements should shed some light.

If you don't have SenseHat, you should able to populate some random values in those registers by updating the python script.

Thanks.

Varathan

Hi Aldo,

Thanks for the update, glad to hear it's working.


It's surprising the addition of the Sense Hat board affected the TCP socket connection, as TCP is very simple (just an IP and a port, then the source/destination three-way handshake). Without that socket connection occurring first, there would be no application-layer transmissions, regardless of the Sense Hat inputs being present or not.

Please let us know if the socket error pops up again. I am sure you won't be the last user to encounter this.

Best regards,

Steven Marchessault

Technical Support Engineer | Kepware Technologies

Announcements


Top Tags