Rice Pastry API

rice.p2p.commonapi.appsocket
Interface AppSocket

All Known Implementing Classes:
SocketAdapter

public interface AppSocket

Interface for sending bulk data from the application. Mimics java's non-blocking SocketChannel interface this should make it easier to implement in any Java-based p2p overlay.


Method Summary
 void close()
          Closes this socket.
 long read(java.nio.ByteBuffer dst)
          Reads a sequence of bytes from this channel into a subsequence of the given buffers.
 long read(java.nio.ByteBuffer[] dsts, int offset, int length)
          Deprecated. use read(ByteBuffer)
 void register(boolean wantToRead, boolean wantToWrite, int timeout, AppSocketReceiver 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 src)
          Writes a sequence of bytes to this channel from a subsequence of the given buffers.
 long write(java.nio.ByteBuffer[] srcs, int offset, int length)
          Deprecated. use write(ByteBuffer)
 

Method Detail

read

long read(java.nio.ByteBuffer[] dsts,
          int offset,
          int length)
          throws java.io.IOException
Deprecated. use read(ByteBuffer)

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

Throws:
java.io.IOException

write

long write(java.nio.ByteBuffer[] srcs,
           int offset,
           int length)
           throws java.io.IOException
Deprecated. use write(ByteBuffer)

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

Throws:
java.io.IOException

read

long read(java.nio.ByteBuffer dst)
          throws java.io.IOException
Reads a sequence of bytes from this channel into a subsequence of the given buffers.

Throws:
java.io.IOException

write

long write(java.nio.ByteBuffer src)
           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,
              int timeout,
              AppSocketReceiver receiver)
Must be called every time a Read/Write occurs to continue operation.

Parameters:
wantToRead - if you want to read from this socket
wantToWrite - if you want to write to this socket
timeout - // the socket's timeout value (this is a TCP level param)
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.


Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection