seda.sandStorm.lib.aSocket
Class ATcpClientSocket

java.lang.Object
  extended by seda.sandStorm.lib.aSocket.ATcpClientSocket

public class ATcpClientSocket
extends java.lang.Object

An ATcpClientSocket implements an asynchronous outgoing socket connection. Applications create an ATcpClientSocket and associate a SinkIF with it. When the connection is established an ATcpConnection object will be pushed to the given SinkIF. The ATcpConnection is then used for actual communication.

A Sandstorm stage would use this as follows:

    SinkIF mySink = config.getSink();  // 'config' passed to stage init()
    ATcpClientSocket sock = new ATcpClientSocket(addr, port, mySink); 
 

See Also:
ATcpConnection

Field Summary
private  java.net.InetAddress address
           
private  int port
           
 
Constructor Summary
protected ATcpClientSocket()
           
  ATcpClientSocket(java.net.InetAddress addr, int port, SinkIF compQ)
          Create a socket connecting to the given address and port.
  ATcpClientSocket(java.net.InetAddress addr, int port, SinkIF compQ, int writeClogThreshold, int connectClogTries)
          Create a socket connecting to the given address and port with the given writeClogThreshold value.
  ATcpClientSocket(java.lang.String host, int port, SinkIF compQ)
          Create a socket connecting to the given host and port.
  ATcpClientSocket(java.lang.String host, int port, SinkIF compQ, int writeClogThreshold, int connectClogTries)
          Create a socket connecting to the given host and port with the given writeClogThreshold value.
 
Method Summary
 java.net.InetAddress getAddress()
          Return the InetAddress which this socket is connected to.
 int getPort()
          Return the port which this socket is connected to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

address

private java.net.InetAddress address

port

private int port
Constructor Detail

ATcpClientSocket

public ATcpClientSocket(java.net.InetAddress addr,
                        int port,
                        SinkIF compQ)
Create a socket connecting to the given address and port. An ATcpConnection will be posted to the given SinkIF when the connection is established. If an error occurs, an ATcpConnectFailedEvent will be posted instead.


ATcpClientSocket

public ATcpClientSocket(java.lang.String host,
                        int port,
                        SinkIF compQ)
                 throws java.net.UnknownHostException
Create a socket connecting to the given host and port. An ATcpConnection will be posted to the given compQ when the connection is established. If an error occurs, an ATcpConnectFailedEvent will be posted instead.

Throws:
java.net.UnknownHostException

ATcpClientSocket

public ATcpClientSocket(java.net.InetAddress addr,
                        int port,
                        SinkIF compQ,
                        int writeClogThreshold,
                        int connectClogTries)
Create a socket connecting to the given address and port with the given writeClogThreshold value. An ATcpConnection will be posted to the given compQ when the connection is established. If an error occurs, an ATcpConnectFailedEvent will be posted instead.

Parameters:
writeClogThreshold - The maximum number of outstanding writes on this socket before a SinkCloggedEvent is pushed to the connection's completion queue. This is effectively the maximum depth threshold for this connection's SinkIF. The default value is -1, which indicates that no SinkCloggedEvents will be generated.
connectClogTries - The number of times the aSocket layer will attempt to push a new entry onto the given SinkIF while the SinkIF is full. The queue entry will be dropped after this many tries. The default value is -1, which indicates that the aSocket layer will attempt to push the queue entry indefinitely.

ATcpClientSocket

public ATcpClientSocket(java.lang.String host,
                        int port,
                        SinkIF compQ,
                        int writeClogThreshold,
                        int connectClogTries)
                 throws java.net.UnknownHostException
Create a socket connecting to the given host and port with the given writeClogThreshold value. An ATcpConnection will be posted to the given compQ when the connection is established. If an error occurs, an ATcpConnectFailedEvent will be posted instead.

Parameters:
writeClogThreshold - The maximum number of outstanding writes on this socket before a SinkCloggedEvent is pushed to the connection's completion queue. This is effectively the maximum depth threshold for this connection's SinkIF. The default value is -1, which indicates that no SinkCloggedEvents will be generated.
connectClogTries - The number of times the aSocket layer will attempt to push a new entry onto the given SinkIF while the SinkIF is full. The queue entry will be dropped after this many tries. The default value is -1, which indicates that the aSocket layer will attempt to push the queue entry indefinitely.
Throws:
java.net.UnknownHostException

ATcpClientSocket

protected ATcpClientSocket()
Method Detail

getAddress

public java.net.InetAddress getAddress()
Return the InetAddress which this socket is connected to.


getPort

public int getPort()
Return the port which this socket is connected to.