libmodbus icon indicating copy to clipboard operation
libmodbus copied to clipboard

Adding TCP server handling to libmodbus

Open johnneren opened this issue 9 years ago • 3 comments

When creating a modbus server you must create your own TCP / socket server handling for libmodbus. This commit aims to integrate this handling into libmodbus since 9 out of 10 users has to make the exact same code.

Features:

  • Function to create a TCP server context where you specify port, ip and max_connection.
  • Handle function which must be called from a task or loop.
  • Destroy function with cleans up and correctly closes all current connections.
  • Function to change select timeout

Uses the modbus specifications method of 'disconnecting the last used connection if max_connection is reached' when accepting new incoming connections.

Still missing the 'prioritized IP' functionality which is also mentioned in the modbus specification but I might add that at a later date :)

johnneren avatar Jul 05 '16 12:07 johnneren

Some feedback would be nice :)

johnneren avatar Aug 18 '16 10:08 johnneren

This is awesome! Thank you! I think your patches should be included in the next libmodbus release.

SirDan1963 avatar May 22 '17 19:05 SirDan1963

Anything that needs to be done in order to get this merged?

esben avatar Mar 01 '18 10:03 esben