Which IP address is selected by PLCnext App when many exists

Hi, We need to create two Modbus servers on the same PLCnext: The first will be hosted by the PLCnext App, using the standard port 502 and the other in a Linux program using the same port, put associated on another IP address. I already found how to create another IP address by searching this forum. My concern is about knowing which one will be selected automatically by the PLCnext app. Is it the one defined in the PLCnext Enginner IDE ? Or Is it the first IP address in the /etc/network/interfaces file? Also, if this PLCnext app IP is changed (by a update from PLCE or Netnames) does the supplementary IP address will be preserved? Thanks FW v2020.6.1 PLCE v2019.9

Hi Frédéric, When you say “PLCnext App”, I assume you mean “PLCnext Engineer project”. If not, you can ignore this answer. I guess that your PLCnext Engineer project will be using the Modbus TCP library from the PLCnext Store. In that library, the Modbus Server FB includes a “BindIp” parameter, where you can specify the IP address that the server will listen on. This can be used if you want complete control over the IP address that the server binds to. If “0.0.0.0” is passed as this parameter, then the FB will select “a suitable Ethernet adapter” (according to the documentation). Let us know if your question is about this option, and I will check with the developers exactly how “a suitable Ethernet adapter” is selected. ~ Martin.

Hi Martin, Yes, you got it right: It is about a PLCnext project using the Modbus TCP library. I am happy to hear about the “BindIp” parameter, but I see that solution as our plan “B”. Our plan “A” would be to use “the suitable Ethernet adapter”, as it would help us deliver the same PLCnext App package to different sites (having different network address requirements) without recreating a new package each time. Probably, this would also enable us to use Netnames transparently. Thanks







image.png

image.png










OK, I will check this with the library developers and let you know. ~ Martin.

Hi Frédéric, It turns out that this Modbus TCP server function block uses the standard PLCnext Engineer TCP_SOCKET FB under the hood. This FB also has a BIND_IP parameter, and the Modbus FB simply passes its own Bind IP parameter directly to the TCP_SOCKET FB. The documentation for BIND_IP parameter of the TCP_SOCKET FB states (with my emphasis): [quote]If this string is empty (= initial value of the parameter) or contains the value ‘0.0.0.0’, the server listens at every Ethernet adapter of the controller.[/quote] … so the Modbus TCP Server FB instance will also listen for a client connection at every IP address on every Ethernet adapter. I hope this answers the question. ~ Martin.