Here is the code for the following info we need to pull

ModbusFactory factory = new ModbusFactory();
IpParameters params = new IpParameters();
params.setHost("192.168.1.100");
params.setPort(502);
params.setEncapsulated(true);
ModbusMaster master = factory.createTcpMaster(params, false);
// master.setRetries(4);
master.setTimeout(50000);
master.setRetries(5);

long start = System.currentTimeMillis(); try { master.init(); for (int i = 0; i < 40; i++) { System.out.println(master.getValue(100, RegisterRange.COIL_STATUS, 100+i, DataType.BINARY)); } } catch (Exception e) { e.printStackTrace(); } finally { master.destroy(); } System.out.println("Took: " + (System.currentTimeMillis() - start) + "ms");

We are trying to pull the values from the following information

Slave ID: 100
Function: 01 Read Coils (0x)
Address: 100
Quantity: 40

This works on another program we downloaded just to see if the PLC was ok and the PLC is working. Whenever we try with Modbus4j it times out. Any help is appreciated!