context.arch.comm.protocol
Class TCPClientSocket

java.lang.Object
  |
  +--context.arch.comm.protocol.TCPClientSocket
Direct Known Subclasses:
HTTPClientSocket

public class TCPClientSocket
extends java.lang.Object

This class implements a simple client socket that sends TCP packets. It does nothing with the TCP packets themselves but can be subclassed to do real work.


Field Summary
static int DEFAULT_PORT
          The default port number to use is 5555
static java.lang.String DEFAULT_SERVER
          The default hostname of the remote server
protected  int portNumber
           
protected  java.lang.String remoteServer
           
 
Constructor Summary
TCPClientSocket()
          Default constructor for TCPClientSocket, with the default port and remote server hostname
TCPClientSocket(int port)
          TCPClientSocket constructor with user-specified port and remote server hostname
TCPClientSocket(java.lang.String server, int port)
          TCPClientSocket constructor with user-specified port and remote server hostname
 
Method Summary
 int getPort()
          Returns the port number on the remote host to connect to
 java.lang.String getServer()
          Returns the remote server's hostname
 void setPort(int port)
          Sets the port number on the remote host to connect to
 void setServer(java.lang.String server)
          Sets the remote server's hostname
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
The default port number to use is 5555

DEFAULT_SERVER

public static final java.lang.String DEFAULT_SERVER
The default hostname of the remote server

portNumber

protected int portNumber

remoteServer

protected java.lang.String remoteServer
Constructor Detail

TCPClientSocket

public TCPClientSocket()
Default constructor for TCPClientSocket, with the default port and remote server hostname
See Also:
DEFAULT_PORT, DEFAULT_SERVER

TCPClientSocket

public TCPClientSocket(int port)
TCPClientSocket constructor with user-specified port and remote server hostname
Parameters:
port - Port number to use
See Also:
DEFAULT_SERVER

TCPClientSocket

public TCPClientSocket(java.lang.String server,
                       int port)
TCPClientSocket constructor with user-specified port and remote server hostname
Parameters:
server - Hostname of remote server to connect to
port - Port number to use
Method Detail

setServer

public void setServer(java.lang.String server)
Sets the remote server's hostname
Parameters:
server - Name of the remote server to connect to

getServer

public java.lang.String getServer()
Returns the remote server's hostname
Returns:
Name of the remote server to connect to

setPort

public void setPort(int port)
Sets the port number on the remote host to connect to
Parameters:
port - Port number on the remote host to connect to

getPort

public int getPort()
Returns the port number on the remote host to connect to
Returns:
Port number on the remote host to connect to