andresarmento / modbus-esp8266

A library that allows your ESP8266 to communicate via Modbus protocol, acting as a slave (master in development). Supports IP via wireless network (Modbus IP).
BSD 3-Clause "New" or "Revised" License
146 stars 236 forks source link

Tcp Keep Alive - modbus-esp8266 #9

Open guiant32 opened 7 years ago

guiant32 commented 7 years ago

Hi all!

Is there a way to keep tcp alive in modbus-esp8266 like "https://github.com/andresarmento/modbus-arduino" ?

I commented "client.stop();" in the file "ModbusIP_ESP8266.cpp" but there was no result.

Thanks.

kg9316 commented 7 years ago

Did you find an answer guiant32 ? I have the same problem.

Quarian3ngineer commented 7 years ago

Is this topic still active?

toto99303 commented 7 years ago

I have the same question, anyone got keep-alive working?

JSengottuvel commented 7 years ago

The following implementation allows to do multiple reads/write with open TCP connection. https://github.com/JhonControl/ESP8266_Industrial_ModbusTCP_V2 Hint: The implementation seems to be unstable when there is a established tcp connection to ESP8266 and second Modbus TCP master is trying to open the port!.

toto99303 commented 7 years ago

Hi, thanks for your reply. I’ve tried the library you suggested and it’s working fine, but I ran into another problem when the TCP connection is kept open – my HTTP server is not responding…

I will revert to your library, because this way I can have more masters reading from the slave ESP and HTTP will be working.

But how to read from SCADA software (Citect) and force the scada software to reconnect after each read? Do you have experience with that?

I’m reading successfully, but only one time and then it doesn’t reconnect…

Thanks in advance!

Regards,

Antonio Velkov

From: Jayakumar [mailto:notifications@github.com] Sent: Saturday, April 22, 2017 2:35 PM To: andresarmento/modbus-esp8266 Cc: toto99303; Comment Subject: Re: [andresarmento/modbus-esp8266] Tcp Keep Alive - modbus-esp8266 (#9)

The following implementation allows to do multiple reads/write with open TCP connection. https://github.com/JhonControl/ESP8266_Industrial_ModbusTCP_V2 Hint: The implementation seems to be is unstable when there is a established tcp connection to ESP8266 and second Modbus TCP master is trying to open the port!.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/andresarmento/modbus-esp8266/issues/9#issuecomment-296367301 , or mute the thread https://github.com/notifications/unsubscribe-auth/ATkZAnugk2PJlWEFdX2cshq_0Q6JvjNGks5ryeX8gaJpZM4J_ChS . https://github.com/notifications/beacon/ATkZAlhXb8yb3hOi5j-lmwhpI_xX53Wtks5ryeX8gaJpZM4J_ChS.gif

JSengottuvel commented 7 years ago

@toto99303 : sorry for late reply. Do you still have an issue?

JSengottuvel commented 7 years ago

So far, we could not managed to implement a stable server on ESP that keeps the connection alive due to stack limitations. As a interim solution, we would suggest to write a simple gateway/bridge application (could run on same PC that runs SCADA). On one end acting as master/client to handle open-close for every reading and on another end acting as slave/server to SCADA system (always open connection).

toto99303 commented 7 years ago

I decided not to use modbus for my project. It's still not that stable as I wished... thanks!

emelianov commented 7 years ago

Guys, in case if you still interesting in ModBus on ESP i've forked the library and trying to continue support. Now I implemented keep alive connection, multiple connections at the same time, callback support and ESP32 support. https://github.com/emelianov/modbus-esp8266

André, if you are reading this, you've done really great job. Thanks!