net.wimpi.modbus.io
Class ModbusUDPTransport

java.lang.Object
  extended by net.wimpi.modbus.io.ModbusUDPTransport
All Implemented Interfaces:
ModbusTransport

public class ModbusUDPTransport
extends Object
implements ModbusTransport

Class that implements the Modbus UDP transport flavor.

Version:
1.0 (29/04/2002)
Author:
Dieter Wimberger

Constructor Summary
ModbusUDPTransport(UDPTerminal terminal)
          Constructs a new ModbusTransport instance, for a given UDPTerminal.
 
Method Summary
 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 writeMessage(ModbusMessage msg)
          Writes a to the output stream of this ModbusTransport.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModbusUDPTransport

public ModbusUDPTransport(UDPTerminal terminal)
Constructs a new ModbusTransport instance, for a given UDPTerminal.

Parameters:
terminal - the UDPTerminal used for message transport.
Method Detail

close

public void close()
           throws IOException
Description copied from interface: ModbusTransport
Closes the raw input and output streams of this ModbusTransport.

Specified by:
close in interface ModbusTransport
Throws:
IOException - if a stream cannot be closed properly.

writeMessage

public void writeMessage(ModbusMessage msg)
                  throws ModbusIOException
Description copied from interface: ModbusTransport
Writes a to the output stream of this ModbusTransport.

Specified by:
writeMessage in interface ModbusTransport
Parameters:
msg - a ModbusMessage.
Throws:
ModbusIOException - data cannot be written properly to the raw output stream of this ModbusTransport.

readRequest

public ModbusRequest readRequest()
                          throws ModbusIOException
Description copied from interface: ModbusTransport
Reads a ModbusRequest from the input stream of this ModbusTransport.

Specified by:
readRequest in interface ModbusTransport
Returns:
req the ModbusRequest read from the underlying stream.
Throws:
ModbusIOException - data cannot be read properly from the raw input stream of this ModbusTransport.

readResponse

public ModbusResponse readResponse()
                            throws ModbusIOException
Description copied from interface: ModbusTransport
Reads a ModbusResponse from the input stream of this ModbusTransport.

Specified by:
readResponse in interface ModbusTransport
Returns:
res the ModbusResponse read from the underlying stream.
Throws:
ModbusIOException - data cannot be read properly from the raw input stream of this ModbusTransport.


Copyright © 2010. All Rights Reserved.