org.objectweb.jonathan.protocols.ip.api
Interface IpConnection

All Known Implementing Classes:
JConnectionMgr.Connection

public interface IpConnection

A IpConnection represents a communication resource. It encapsulates a socket. A connection may always be related to a given session, i.e., a communication channel.


Method Summary
 int available()
           
 void delete()
          Deletes this connection, removing it from the connection manager, and closing the socket.
 void emit(Chunk chunk)
           
 String getHostName()
          Returns the host name of the underlying socket.
 int getPort()
          Returns the port number of the underlying socket.
 IpSession getSession()
          Returns the session attached to this connection.
 void receive(Chunk chunk, int sz)
           
 void release()
          Releases this connection.
 void setSession(IpSession session)
          Attaches a new session to this connection.
 

Method Detail

getSession

IpSession getSession()
Returns the session attached to this connection.

Returns:
the session attached to this connection.

setSession

void setSession(IpSession session)
Attaches a new session to this connection.

Parameters:
session - the session to be attached to the target connection.

receive

void receive(Chunk chunk,
             int sz)
             throws IOException
Throws:
IOException

available

int available()
              throws IOException
Throws:
IOException

emit

void emit(Chunk chunk)
          throws IOException
Throws:
IOException

getPort

int getPort()
Returns the port number of the underlying socket.

Returns:
the port number of the underlying socket.

getHostName

String getHostName()
Returns the host name of the underlying socket.

Returns:
the host name of the underlying socket.

release

void release()
Releases this connection. This is to indicate to the connection manager that this connection is no longer used.


delete

void delete()
Deletes this connection, removing it from the connection manager, and closing the socket. This method should not be used a a socket user unless a problem occurs on the connection, like an exception when trying to read or to write data.