net.sf.asyncobjects.net.threading
Class TSocket

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

public class TSocket
extends AsyncUnicastServer<ASocket>
implements ASocket

implementation of socket with threads. jdk 1.3 required.


Nested Class Summary
 class TSocket.TInputStreamAdapter
          Adapter for socket's input stream.
 class TSocket.TOutputStreamAdapter
          Adapter for socket output stream.
 
Constructor Summary
TSocket(VatRunner runner)
          A constructor
TSocket(VatRunner runner, Socket socket)
          A socket
 
Method Summary
 Promise<Void> close()
          Close resource
 Promise<Void> connect(String host, int port)
          Connect to specific host and port
 Promise<AByteInput> getInput()
           
 Promise<AByteOutput> getOutput()
           
 Promise<Boolean> getTcpNoDelay()
          Get TCP_NODELAY
 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
 

Constructor Detail

TSocket

public TSocket(VatRunner runner)
A constructor

Parameters:
runner - runner used to create streams

TSocket

public TSocket(VatRunner runner,
               Socket socket)
A socket

Parameters:
runner - vat group used to create streams
socket - existing socket
Method Detail

connect

public Promise<Void> connect(String host,
                             int port)
Connect to specific host and port

Specified by:
connect in interface ASocket
Parameters:
host - a host
port - a port
Returns:
a promise that resolves when connect operation finishes
See Also:
ASocket.connect(String, int)

getInput

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

setTcpNoDelay

public Promise<Void> setTcpNoDelay(boolean optionValue)
Description copied from interface: ASocket
Set TCP_NODELAY option

Specified by:
setTcpNoDelay in interface ASocket
Parameters:
optionValue - option value
Returns:
when option is set
See Also:
ASocket.setTcpNoDelay(boolean)

getTcpNoDelay

public Promise<Boolean> getTcpNoDelay()
Get TCP_NODELAY

Specified by:
getTcpNoDelay in interface ASocket
Returns:
an option value
See Also:
Socket.getTcpNoDelay()

getOutput

public Promise<AByteOutput> getOutput()
Specified by:
getOutput in interface AChannel<BinaryData,AByteInput,AByteOutput>
Returns:
output of the socket
See Also:
AChannel.getOutput()

close

public Promise<Void> close()
Description copied from interface: ACloseable
Close resource

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


Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.