org.objectweb.jonathan.protocols.ip.api

Interface IpConnection

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 Details

available

public int available()
            throws IOException


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.


emit

public void emit(Chunk chunk)
            throws IOException


getHostName

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

Returns:
the host name of the underlying socket.


getPort

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

Returns:
the port number of the underlying socket.


getSession

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

Returns:
the session attached to this connection.


receive

public void receive(Chunk chunk,
                    int sz)
            throws IOException


release

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


setSession

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

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