|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.wimpi.modbus.io.ModbusTCPTransport
public class ModbusTCPTransport
Class that implements the Modbus transport flavor.
| Field Summary | |
|---|---|
private BytesInputStream |
m_ByteIn
|
private DataInputStream |
m_Input
|
private DataOutputStream |
m_Output
|
| Constructor Summary | |
|---|---|
ModbusTCPTransport(Socket socket)
Constructs a new ModbusTransport instance, for a given Socket. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the raw input and output streams of this ModbusTransport. |
private void |
prepareStreams(Socket socket)
Prepares the input and output streams of this ModbusTCPTransport instance based on the given socket. |
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 to the output stream of this ModbusTransport. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private DataInputStream m_Input
private DataOutputStream m_Output
private BytesInputStream m_ByteIn
| Constructor Detail |
|---|
public ModbusTCPTransport(Socket socket)
socket - the Socket used for message transport.| Method Detail |
|---|
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
ModbusTransport
close in interface ModbusTransportIOException - if a stream
cannot be closed properly.
public void writeMessage(ModbusMessage msg)
throws ModbusIOException
ModbusTransport
writeMessage in interface ModbusTransportmsg - a ModbusMessage.
ModbusIOException - data cannot be
written properly to the raw output stream of
this ModbusTransport.
public ModbusRequest readRequest()
throws ModbusIOException
ModbusTransport
readRequest in interface ModbusTransportModbusIOException - data cannot be
read properly from the raw input stream of
this ModbusTransport.
public ModbusResponse readResponse()
throws ModbusIOException
ModbusTransport
readResponse in interface ModbusTransportModbusIOException - data cannot be
read properly from the raw input stream of
this ModbusTransport.
private void prepareStreams(Socket socket)
throws IOException
socket - the socket used for communications.
IOException - if an I/O related error occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||