Error while polling
-
I take it you're using UDP. Some background...
Request messages are sent, and then the thread "sits in the waiting room" for the response to come back. After a timeout the thread leaves the waiting room, shrugs its shoulders, and says that it didn't get a response.
Later, a response is received, but by that time "no recipient was found waiting for response".
Solution: increase your timeout.
-
I'm using TCP.
How can I avoid this error?
-
Im not responding.
-
Solution: increase your timeout.
-
How much? I have my modbus server turn off.
-
As much as needed to make the message go away. Seriously, i can't be more specific than that.
-
hi,
I have almost the same problem with the WaitingRoomException.
I set the timeout to different values with the same result, but the message
is received anyways.output:
request:
00 00 00 00 00 06 03 03 00 01 00 0C ............com.serotonin.messaging.WaitingRoomException: No recipient was found waiting for response for key com.serotonin.modbus4j.ip.xa.XaWaitingRoomKey@8008
at com.serotonin.messaging.WaitingRoom.response(WaitingRoom.java:69)
at com.serotonin.messaging.MessageControl.data(MessageControl.java:153)
at com.serotonin.messaging.InputStreamListener.run(InputStreamListener.java:76)
at java.lang.Thread.run(Thread.java:595)
response:
00 00 00 00 00 1B 03 03 18 43 67 12 25 00 00 00 .........Cg.%...
00 00 00 00 00 43 67 12 25 00 00 00 00 43 67 12 .....Cg.%....Cg.
25 %{voltage 1=231.07088, voltage 6=231.07088, voltage 4=231.07088, voltage 3=0.0, voltage 2=0.0, voltage 5=0.0}
Source:
package test.sim; import com.serotonin.modbus4j.BatchRead; import com.serotonin.modbus4j.BatchResults; import com.serotonin.modbus4j.ModbusFactory; import com.serotonin.modbus4j.ModbusLocator; import com.serotonin.modbus4j.ModbusMaster; import com.serotonin.modbus4j.code.DataType; import com.serotonin.modbus4j.code.RegisterRange; import com.serotonin.modbus4j.ip.IpParameters; public class BatchTest { public static void main(String[] args) throws Exception { IpParameters tcpParameters = new IpParameters(); tcpParameters.setHost("10.17.175.43"); ModbusFactory modbusFactory = new ModbusFactory(); ModbusMaster master = modbusFactory.createTcpMaster(tcpParameters, true); // master.setTimeout(5000); for(int i = 0; i < 50; i++) { try { BatchRead<String> batchRead = new BatchRead<String>(); int slaveId = 3; ModbusLocator locator = new ModbusLocator(slaveId, RegisterRange.HOLDING_REGISTER, 1, DataType.FOUR_BYTE_FLOAT); ModbusLocator locator2 = new ModbusLocator(slaveId, RegisterRange.HOLDING_REGISTER, 3, DataType.FOUR_BYTE_FLOAT); ModbusLocator locator3 = new ModbusLocator(slaveId, RegisterRange.HOLDING_REGISTER, 5, DataType.FOUR_BYTE_FLOAT); ModbusLocator locator4 = new ModbusLocator(slaveId, RegisterRange.HOLDING_REGISTER, 7, DataType.FOUR_BYTE_FLOAT); ModbusLocator locator5 = new ModbusLocator(slaveId, RegisterRange.HOLDING_REGISTER, 9, DataType.FOUR_BYTE_FLOAT); ModbusLocator locator6 = new ModbusLocator(slaveId, RegisterRange.HOLDING_REGISTER, 11, DataType.FOUR_BYTE_FLOAT); batchRead.addLocator("voltage 1", locator); batchRead.addLocator("voltage 2", locator2); batchRead.addLocator("voltage 3", locator3); batchRead.addLocator("voltage 4", locator4); batchRead.addLocator("voltage 5", locator5); batchRead.addLocator("voltage 6", locator6); master.init(); BatchResults<String> results = master.send(batchRead); System.err.println(results); } finally { master.destroy(); } } } }
Thanking you in anticipation!
-
How much? I have my modbus server turn off.
I guess i didn't read the entire question. If your modbus server is turned off, shouldn't you expect an error? There is obviously no appropriate timeout for equipment that will never answer.
-
Luke, what happens if you increase the timeout?