org.universAAL.lddi.zwave.exporter.Server
Interface ISocketServerConnection

Package class diagram package ISocketServerConnection
All Superinterfaces:
Closeable
All Known Implementing Classes:
ConnectionDataHandler

public interface ISocketServerConnection
extends Closeable

Interface to be implemented by the classes handling socket connections.

Version:
$Rev: 5339 $ $Date: 2012-09-25 17:17:28 +0200 (mar, 25 sep 2012) $
Author:
fraperod

Method Summary
 int getConnectionReceivedPackets()
          Gets the number of packets received through this connection.
 int getConnectionSentPackets()
          Gets the number of packets successfully sent.
 int getId()
          Gets the identifier number of the connection.
 InetAddress getRemoteAddress()
          Returns the remote IP address.
 int getRemotePort()
          Returns the remote port.
 boolean isConnectionClosed()
          Returns false if the connection connections is already closed, true if it is still opened.
 void setConnectionLister(ISocketServerConnectionListener listener)
          Set the listener.
 void setId(int connectionId)
          .
 void writeToConnection(ByteBuffer data)
          Sends the data passed in a ByteBuffer through the connection.
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

setConnectionLister

void setConnectionLister(ISocketServerConnectionListener listener)
Set the listener.

Parameters:
listener - listener.

getConnectionReceivedPackets

int getConnectionReceivedPackets()
Gets the number of packets received through this connection.

Returns:
Total number of packets received through this connection

getConnectionSentPackets

int getConnectionSentPackets()
Gets the number of packets successfully sent.

Returns:
Total number of packets sent by the connection. Which is the number of writeToConnection calls that finished successfully

getId

int getId()
Gets the identifier number of the connection. Each connection will have an unique identifier.

Returns:
Identifier number of the connection

isConnectionClosed

boolean isConnectionClosed()
Returns false if the connection connections is already closed, true if it is still opened.

Returns:
true if the connection is closed, false if it is open

setId

void setId(int connectionId)
.

Parameters:
connectionId - integer used to identify the connection.

writeToConnection

void writeToConnection(ByteBuffer data)
Sends the data passed in a ByteBuffer through the connection. This is an asynchronous method, so it returns immediately. When the packet is passt to the lower layer packetSent is called back

Parameters:
data - byte buffer containing the data to be sent

getRemoteAddress

InetAddress getRemoteAddress()
Returns the remote IP address.

Returns:
the remote IP address.

getRemotePort

int getRemotePort()
Returns the remote port.

Returns:
the remote port.


Copyright © 2014 universAAL Consortium. All Rights Reserved.