I am trying to simulate an TCP Modbus slave.

I extended the class TcpSlave for this and added some Process Images.

Unfortunately, the TcpSlave provides only the port to set.

How can I set the IP Address of the slave ?

I tried to add the following code snippet in TcpSlave but it doesn't help :



    @Override
    public void start() throws ModbusInitException {
        try {
            serverSocket = new ServerSocket(port);

           //Socket socket;


            
          //this should be the ip address of the slave
           Socket socket = new Socket("192.168.20.100", 502);




            while (true) {
                socket = serverSocket.accept();
                TcpConnectionHandler handler = new TcpConnectionHandler(socket);
                executorService.execute(handler);
            }



Can someone help me ?