node-modbus-serial icon indicating copy to clipboard operation
node-modbus-serial copied to clipboard

Port not open error on TCP connection

Open Naim-Bijapure opened this issue 2 years ago • 5 comments

2022-06-07_16-32 hi, I am getting a port not found error on the TCP connection.

actually, we are fetching plc data every 1 minute. the issue is coming after 6-8 hours. I am getting port not found error . and after node server restart it starts again !

is there any solution for this? i am on version 8.0.5

please help

Naim-Bijapure avatar Jun 07 '22 10:06 Naim-Bijapure

hi, thank you for the issue :green_heart: I have added a "help wanted" in case someone knows how to fix it.

can you try and look for the offending code ? can you try and fix it ?

yaacov avatar Jun 07 '22 11:06 yaacov

@yaacov yes i can . but the issue is coming on real plc connection. it's perfectly working on the simulator. if you give me some pointers I can take a look.

Naim-Bijapure avatar Jun 07 '22 15:06 Naim-Bijapure

sounds like the plc disconnects from time to time, if this is the error, you may solve it by using a socket/port that can detect a "socket not found" error and tries to re-connect ? if this is the problem, and if reconnecting solve it, a way forward can be to add an option to the TCP port to "reconnect on error"? ( I don't know the problem source :-) )

yaacov avatar Jun 07 '22 15:06 yaacov

Same issue here. My app automatically tries to reconnect, but gives Port not open error. When i shut down the app and restart it connects again without any issues. The problem occurs when a tcp connection looses or there is a tcp error and tries to reconnect. Did you find something workaround?

arnolddozsa avatar Aug 02 '22 11:08 arnolddozsa

I had this error, too. In my case a max connection limit on the modbus server caused this error. I had to change my program to operate sequencielly and not in parallel.

pmb0 avatar Aug 24 '22 17:08 pmb0