Modbus TCP

DSGarcia

Member
Joined
Sep 20, 2005
Messages
5
Location
Texas
Programming Experience
10+
I have an Ethernet based I/O block that uses the Modbus/TCP protocol. I would just like to read all the inputs (ports 5-8) at once and also set individual outputs one at a time (ports 1-4). Can someone point me to some simple code? I do not need the whole protocol, just these two simple things.
 
With TcpClient (a common Socket implementation) you can connect to one endpoint at a time, endpoint is IP+port. So use one TcpClient for each simulatenous connection you need. The NetworkStream (from GetStream, where it wraps the Socket) has asynchronous methods, or you can use other common multithreading functionality.
 
Back
Top