org.objectweb.jonathan.apis.protocols.ip
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)
           
 java.lang.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

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

Returns:
the session attached to this connection.

setSession

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

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

receive

public void receive(Chunk chunk,
                    int sz)
             throws java.io.IOException
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Throws:
java.io.IOException

emit

public void emit(Chunk chunk)
          throws java.io.IOException
Throws:
java.io.IOException

getPort

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

Returns:
the port number of the underlying socket.

getHostName

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

Returns:
the host name of the underlying socket.

release

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


delete

public 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.