Rice Pastry API

org.mpisws.p2p.transport.wire
Class TCPLayer

java.lang.Object
  extended by rice.selector.SelectionKeyHandler
      extended by org.mpisws.p2p.transport.wire.TCPLayer

public class TCPLayer
extends SelectionKeyHandler


Field Summary
 int MAX_OPEN_SOCKETS
           
static java.util.Map<java.lang.String,java.lang.Integer> OPTIONS
           
 int SOCKET_BUFFER_SIZE
           
 
Constructor Summary
TCPLayer(WireTransportLayerImpl wire)
           
 
Method Summary
 void accept(java.nio.channels.SelectionKey key)
          Specified by the SelectionKeyHandler interface.
 void acceptSockets(boolean b)
           
 void destroy()
          Method which cloeses a socket to a given remote node handle, and updates the bookkeeping to keep track of this closing.
 SocketRequestHandle<java.net.InetSocketAddress> openSocket(java.net.InetSocketAddress destination, SocketCallback<java.net.InetSocketAddress> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Integer> options)
           
 
Methods inherited from class rice.selector.SelectionKeyHandler
connect, modifyKey, read, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIONS

public static final java.util.Map<java.lang.String,java.lang.Integer> OPTIONS

MAX_OPEN_SOCKETS

public final int MAX_OPEN_SOCKETS

SOCKET_BUFFER_SIZE

public final int SOCKET_BUFFER_SIZE
Constructor Detail

TCPLayer

public TCPLayer(WireTransportLayerImpl wire)
         throws java.io.IOException
Throws:
java.io.IOException
Method Detail

openSocket

public SocketRequestHandle<java.net.InetSocketAddress> openSocket(java.net.InetSocketAddress destination,
                                                                  SocketCallback<java.net.InetSocketAddress> deliverSocketToMe,
                                                                  java.util.Map<java.lang.String,java.lang.Integer> options)

destroy

public void destroy()
Method which cloeses a socket to a given remote node handle, and updates the bookkeeping to keep track of this closing. Note that this method does not completely close the socket, rather, it simply calls shutdown(), which starts the shutdown process.

Parameters:
address - The address of the remote node

acceptSockets

public void acceptSockets(boolean b)

accept

public void accept(java.nio.channels.SelectionKey key)
Specified by the SelectionKeyHandler interface. Is called whenever a key has become acceptable, representing an incoming connection. This method will accept the connection, and attach a SocketConnector in order to read the greeting off of the channel. Once the greeting has been read, the connector will hand the channel off to the appropriate node handle.

Overrides:
accept in class SelectionKeyHandler
Parameters:
key - The key which is acceptable.

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection