Is it possible to run multiple modbus asynchronous servers from different IP addresses on the same machine? I'd like to keep the ports for the different IPs at default of 502.
as mentioned in the response to the above example, if I don't use threading, only 1 server is ran. So i added a second IP alias to my NIC card configuration (such that it looks like it is hosting 2 ip addresses). I then tried to use threading to start multiple instances of the modbus TCP server. When I do this, the "reactor" module is unhappy that I am trying to call it from another thread after it has already been called.
Is there any way to run multiple asynchronous modbus servers from the same machine? That way I could use port 502 and scale the number of devices with IP address instead of port. If you you limit to one IP and one port then i can only max out at 255 devices, correct?
Here is what i was trying to do:
#set IPs for modbus gateways
port = 502
ip1 = "172.16.1.40"
ip2 = "172.16.1.41"
addy1 = (ip1,port)
addy2 = (ip2,port)
t1 = threading.Thread(target=StartTcpServer, args=[context,identity1,(ip1,port)])
t1.start()
t2 = threading.Thread(target=StartTcpServer, args=[context,identity1,(ip2,port)])
t2.start()