ModSnmp Manual v3.10 - 9. Modbus server
In addition to its normal use as a SNMP-Modbus converter, ModSnmp can simultaneously operate as a Modbus bridge. This means that it can act as a Modbus TCP server/slave, receiving requests from Modbus clients/masters and responding to these requests with data obtained from the Modbus devices.
Ordinary Modbus read and write requests (function codes 1, 2, 3, 4, 5, 6, 15 and 16) will cache data when possible. Other Modbus requests will simply be forwarded to the device, and the device's response will be returned to the Modbus client/master.
The slave IDs (unit identifiers) used by the Modbus server to identify the devices are not the same as the slave IDs configured in the devices themselves (since multiple devices may have the same slave ID if they are on different interfaces). The Modbus client/master should use slave ID 1 to refer to the first configured device, slave ID 2 to refer to the second configured device, and so on. If more than 254 devices have been configured, only the first 254 will be accessible via the Modbus server.
The Modbus Server page enables you to configure the Modbus server:
Host. You would normally leave this field empty, which allows Modbus/TCP connections to be accepted via any network interface. But if you enter a host name or IP address of a network interface on the machine running ModSnmp, then ModSnmp will only accept connections that network interface. For example, if you enter
127.0.0.1) then ModSnmp will only accept connections from processes running on the same machine.
Port. Enter the port that ModSnmp should listen on for Modbus/TCP connections. The standard Modbus port number is 502, but this is a "privileged" port and you will not be able to listen on this port on a Unix/Linux machine unless you are "superuser". This is not normally advisable, so it's better for testing purposes to use a non-privileged port (above 1023).
EOM Timeout. The maximum delay (in milliseconds) expected within a message. The default value works fine in most situations, but you may need to increase the value if you are using a connection that introduces large delays in the middle of messages.
A connection is considered to be idle if no requests from the client/master have been responded to within the timeout period.
Setting an idle timeout can be used to avoid holding on to resources that are not currently in use.