public class ModbusTCPTransport extends Object implements ModbusTransport
| Constructor and Description |
|---|
ModbusTCPTransport(Socket socket)
Constructs a new ModbusTransport instance,
for a given Socket.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the raw input and output streams of
this ModbusTransport.
|
ModbusRequest |
readRequest()
Reads a ModbusRequest from the
input stream of this ModbusTransport.
|
ModbusResponse |
readResponse()
Reads a ModbusResponse from the
input stream of this ModbusTransport.
|
void |
setSocket(Socket socket)
Sets the Socket used for message transport and
prepares the streams used for the actual I/O.
|
void |
writeMessage(ModbusMessage msg)
Writes a ModbusMessage to the
output stream of this ModbusTransport.
|
public ModbusTCPTransport(Socket socket)
socket - the Socket used for message transport.public void setSocket(Socket socket) throws IOException
socket - the Socket used for message transport.IOException - if an I/O related error occurs.public void close()
throws IOException
ModbusTransportclose in interface ModbusTransportIOException - if a stream cannot be closed properly.public void writeMessage(ModbusMessage msg) throws ModbusIOException
ModbusTransportwriteMessage in interface ModbusTransportmsg - a ModbusMessage.ModbusIOException - data cannot be written properly to the raw output stream of this ModbusTransport.public ModbusRequest readRequest() throws ModbusIOException
ModbusTransportreadRequest in interface ModbusTransportModbusIOException - data cannot be read properly from the raw input stream of this ModbusTransport.public ModbusResponse readResponse() throws ModbusIOException
ModbusTransportreadResponse in interface ModbusTransportModbusIOException - data cannot be read properly from the raw input stream of this ModbusTransport.Copyright © 2017. All rights reserved.