Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mpisws.p2p.transport
Interface P2PSocket<Identifier>

Type Parameters:
  `Identifier` - the identification of the remote node

All Known Implementing Classes:
  RecordSocket, ReplaySocket, SocketManager, SocketWrapperSocket, SourceRouteManagerP2PSocket

    public interface P2PSocket<Identifier>

A socket in the layered transport layer.

Author:
  Jeff Hoye

Method Summary
`void` | `close()` Closes this socket.
`Identifier` | `getIdentifier()` The identification of the node at the other end of the socket.
`java.util.Map<java.lang.String,java.lang.Object>` | `getOptions()` Details on the connectivity of the socket (encrypted, source-routed etc)
`long` | `read(java.nio.ByteBuffer dsts)` Reads a sequence of bytes from this channel into a subsequence of the given buffer.
`void` | `register(boolean wantToRead, boolean wantToWrite, P2PSocketReceiver<Identifier> receiver)` Must be called every time a Read/Write occurs to continue operation.
`void` | `shutdownOutput()` Disables the output stream for this socket.
`long` | `write(java.nio.ByteBuffer srcs)` Writes a sequence of bytes to this channel from a subsequence of the given buffers.

Method Detail

### getOptions

    java.util.Map<java.lang.String,java.lang.Object> getOptions()

  Details on the connectivity of the socket (encrypted, source-routed etc)

  Returns:
    a read-only list of options on this socket

### getIdentifier

    Identifier getIdentifier()

  The identification of the node at the other end of the socket.

  Returns:
    The identification of the node at the other end of the socket.

### read

    long read(java.nio.ByteBuffer dsts)
              throws java.io.IOException

  Reads a sequence of bytes from this channel into a subsequence of the given buffer.

  Parameters:
    `dsts` -
  Returns:
  Throws:
    `java.io.IOException`

### write

    long write(java.nio.ByteBuffer srcs)
               throws java.io.IOException

  Writes a sequence of bytes to this channel from a subsequence of the given buffers.

  Throws:
    `java.io.IOException`

### register

    void register(boolean wantToRead,
                  boolean wantToWrite,
                  P2PSocketReceiver<Identifier> receiver)

  Must be called every time a Read/Write occurs to continue operation. Can cancel this task by calling with null.

  Parameters:
    `wantToRead` - if you want to read from this socket
    `wantToWrite` - if you want to write to this socket
    `receiver` - will have receiveSelectResult() called on it note that you must call select() each time receiveSelectResult() is called. This is so your application can properly handle flow control

### shutdownOutput

    void shutdownOutput()

  Disables the output stream for this socket. Used to properly close down a socket used for bi-directional communication that can be initated by either side.

### close

    void close()

  Closes this socket.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.