Why are there two two RJ45 sockets for the connection
Only if a "Device Level Ring (DLR)", an optional feature of this fieldbus, is used for greater reliability (redundancy), both connections are required.
In addition, the two ports can be used to chain a number of devices without forming a DLR ring. (So you do not need a separate Ethernet switch to operate several devices on one PLC).