How do I send signal to modbus over TCP/IP in java?

I am working on a client application that is supposed to send a signal to modbus that opens and close a gate with ip address and non-changeable port number 502. The instruction say to create a win-socket client application and send command buffer. I don't understand how to send the command buffer. This is a snapshot of commands.Modbus CommandsI have created a Java socket client class but I don't know what message to send and what datatype to use to send a message. or am I supposed to use one of the modbus libraries to send a signal. Thank you! ...Read more

byte count in the Modbus TCP PDU

I am writing a Modbus TCP Master to communicate with the Modbus TCP slaves.I am having issue in figuring out the right format of the packetThis is the standard packet format: | Tx ID | Proto ID | Length | Unit ID ***| FCode | Data |***As we know, the FCode & Data forms the PDU of the comms.But my Modbus TCP slave has one byte at the front for the number of bytes transmitted.looks like this:| Tx ID | Proto ID | Length | Unit ID ***| FCode | byte count | Data |***My question is this in anyway violation of the Modbus TCP spec ?...Read more

Can you keep a CRC in a Modbus TCP message?

Another modbus question here, I've been learning Modbus RTU and feel that I have a pretty good grasp on it and am now writing code to convert RTU to TCP.A question that was brought up to me today was, when you are converting from RTU to TCP, can you leave the CRC on the end?I know that the TCP structure does not contain a CRC but I'm not sure why?Any insight to this would be quite helpful :)...Read more

modbus tcp - Modbuspal slave and Jamod as tcp master

I'm using Modbuspal simulator as slave and Jamod tcp master code as master. The following is my Jamod tcp master code to read data from registers:import;import;import net.wimpi.modbus.msg.ReadInputDiscretesRequest;import net.wimpi.modbus.msg.ReadInputDiscretesResponse;import;public class SlaveTest {Logger LOG = LoggerFactory.getLogger(SlaveTest.class);TCPMasterConnection connection;ModbusTCPTransaction transaction = null; //the transactionRead...Read more