net.wimpi.modbus.net
Class TCPSlaveConnection

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

public class TCPSlaveConnection
extends Object

Class that implements a TCPSlaveConnection.

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

Field Summary
private  boolean m_Connected
           
private  ModbusTCPTransport m_ModbusTransport
           
private  Socket m_Socket
           
private  int m_Timeout
           
 
Constructor Summary
TCPSlaveConnection(Socket socket)
          Constructs a TCPSlaveConnection instance using a given socket instance.
 
Method Summary
 void close()
          Closes this TCPSlaveConnection.
 InetAddress getAddress()
          Returns the destination InetAddress of this TCPMasterConnection.
 ModbusTransport getModbusTransport()
          Returns the ModbusTransport associated with this TCPMasterConnection.
 int getPort()
          Returns the destination port of this TCPMasterConnection.
 int getTimeout()
          Returns the timeout for this TCPMasterConnection.
 boolean isConnected()
          Tests if this TCPMasterConnection is connected.
private  void setSocket(Socket socket)
          Prepares the associated ModbusTransport of this TCPMasterConnection for use.
 void setTimeout(int timeout)
          Sets the timeout for this TCPSlaveConnection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Socket

private Socket m_Socket

m_Timeout

private int m_Timeout

m_Connected

private boolean m_Connected

m_ModbusTransport

private ModbusTCPTransport m_ModbusTransport
Constructor Detail

TCPSlaveConnection

public TCPSlaveConnection(Socket socket)
Constructs a TCPSlaveConnection instance using a given socket instance.

Parameters:
socket - the socket instance to be used for communication.
Method Detail

close

public void close()
Closes this TCPSlaveConnection.


getModbusTransport

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

Returns:
the connection's ModbusTransport.

setSocket

private void setSocket(Socket socket)
                throws IOException
Prepares the associated ModbusTransport of this TCPMasterConnection for use.

Parameters:
socket - the socket to be used for communication.
Throws:
IOException - if an I/O related error occurs.

getTimeout

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

Returns:
the timeout as int.

setTimeout

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

Parameters:
timeout - the timeout as int.

getPort

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

Returns:
the port number as int.

getAddress

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

Returns:
the destination address as InetAddress.

isConnected

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

Returns:
true if connected, false otherwise.


Copyright © 2012. All Rights Reserved.