net.sf.asyncobjects.net.nio
Class NIOSocket

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<ASocket>
      extended by net.sf.asyncobjects.net.nio.NIOSocket
All Implemented Interfaces:
ACloseable, AsyncObject, ExplicitSharing, AByteChannel, AChannel<BinaryData,AByteInput,AByteOutput>, ASocket

public class NIOSocket
extends AsyncUnicastServer<ASocket>
implements ASocket

NIO-based implementation of socket


Method Summary
 Promise<Void> close()
          close the socket
 Promise<Void> connect(String host, int port)
          A connecto operation
 Promise<AByteInput> getInput()
           
 Promise<AByteOutput> getOutput()
           
 Promise<Boolean> getTcpNoDelay()
          Set TCP_NODELAY option
 Promise<Void> setTcpNoDelay(boolean optionValue)
          Set TCP_NODELAY option
 
Methods inherited from class net.sf.asyncobjects.AsyncUnicastServer
dereference, export, isImmediate, myVat, promise
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate
 

Method Detail

connect

public Promise<Void> connect(String host,
                             int port)
A connecto operation

Specified by:
connect in interface ASocket
Parameters:
host - a host
port - a port
Returns:
null when connection is finished
See Also:
ASocket.connect(String, int)

getInput

public Promise<AByteInput> getInput()
Specified by:
getInput in interface AChannel<BinaryData,AByteInput,AByteOutput>
Returns:
input stream
See Also:
AChannel.getInput()

getOutput

public Promise<AByteOutput> getOutput()
Specified by:
getOutput in interface AChannel<BinaryData,AByteInput,AByteOutput>
Returns:
ouput stream
See Also:
AChannel.getOutput()

close

public Promise<Void> close()
close the socket

Specified by:
close in interface ACloseable
Returns:
a promise that resolves when socket is clsoed
See Also:
ACloseable.close()

setTcpNoDelay

public Promise<Void> setTcpNoDelay(boolean optionValue)
Set TCP_NODELAY option

Specified by:
setTcpNoDelay in interface ASocket
Parameters:
optionValue - an option value
Returns:
a promise or null
See Also:
ASocket.setTcpNoDelay(boolean)

getTcpNoDelay

public Promise<Boolean> getTcpNoDelay()
Set TCP_NODELAY option

Specified by:
getTcpNoDelay in interface ASocket
Returns:
optionValue an option value or promise for it
See Also:
ASocket.getTcpNoDelay()


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.