net.wimpi.modbus.net
Class UDPMasterConnection

java.lang.Object
  extended by net.wimpi.modbus.net.UDPMasterConnection

public class UDPMasterConnection
extends Object

Class that implements a UDPMasterConnection.

Version:
@version@ (@date@)
Author:
Dieter Wimberger

Constructor Summary
UDPMasterConnection(InetAddress adr)
          Constructs a UDPMasterConnection instance with a given destination address.
 
Method Summary
 void close()
          Closes this UDPMasterConnection.
 void connect()
          Opens this UDPMasterConnection.
 InetAddress getAddress()
          Returns the destination InetAddress of this UDPMasterConnection.
 ModbusTransport getModbusTransport()
          Returns the ModbusTransport associated with this UDPMasterConnection.
 int getPort()
          Returns the destination port of this UDPMasterConnection.
 UDPTerminal getTerminal()
          Returns the terminal used for handling the package traffic.
 int getTimeout()
          Returns the timeout for this UDPMasterConnection.
 boolean isConnected()
          Tests if this UDPMasterConnection is connected.
 void setAddress(InetAddress adr)
          Sets the destination InetAddress of this UDPMasterConnection.
 void setPort(int port)
          Sets the destination port of this UDPMasterConnection.
 void setTimeout(int timeout)
          Sets the timeout for this UDPMasterConnection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDPMasterConnection

public UDPMasterConnection(InetAddress adr)
Constructs a UDPMasterConnection instance with a given destination address.

Parameters:
adr - the destination InetAddress.
Method Detail

connect

public void connect()
             throws Exception
Opens this UDPMasterConnection.

Throws:
Exception - if there is a network failure.

close

public void close()
Closes this UDPMasterConnection.


getModbusTransport

public ModbusTransport getModbusTransport()
Returns the ModbusTransport associated with this UDPMasterConnection.

Returns:
the connection's ModbusTransport.

getTerminal

public UDPTerminal getTerminal()
Returns the terminal used for handling the package traffic.

Returns:
a UDPTerminal instance.

getTimeout

public int getTimeout()
Returns the timeout for this UDPMasterConnection.

Returns:
the timeout as int.

setTimeout

public void setTimeout(int timeout)
Sets the timeout for this UDPMasterConnection.

Parameters:
timeout - the timeout as int.

getPort

public int getPort()
Returns the destination port of this UDPMasterConnection.

Returns:
the port number as int.

setPort

public void setPort(int port)
Sets the destination port of this UDPMasterConnection. The default is defined as Modbus.DEFAULT_PORT.

Parameters:
port - the port number as int.

getAddress

public InetAddress getAddress()
Returns the destination InetAddress of this UDPMasterConnection.

Returns:
the destination address as InetAddress.

setAddress

public void setAddress(InetAddress adr)
Sets the destination InetAddress of this UDPMasterConnection.

Parameters:
adr - the destination address as InetAddress.

isConnected

public boolean isConnected()
Tests if this UDPMasterConnection is connected.

Returns:
true if connected, false otherwise.


Copyright © 2010. All Rights Reserved.