Client
Class Client

java.lang.Object
  |
  +--Client.Client

public class Client
extends java.lang.Object

A client initiating a single connection and sends/receives messages


Field Summary
private  boolean isConnected
          A predicate that says whether we are connected
private  ServerEchoListener serverEchoListener
          A thread that listens on the network for server messages
private  java.net.Socket socket
          The Socket on which the server communicating.
private  java.io.BufferedReader sockIn
          An input for this socket
private  java.io.BufferedWriter sockOut
          An output for this socket
private  UserSend userSend
          a thread that sits on the shared fifo pipe and sends messages to the server
 
Constructor Summary
Client()
           
 
Method Summary
 java.net.Socket connect(java.lang.String server_host, int server_port)
          Initiate a connection to a server
 java.net.Socket doConnect(java.lang.String server_host, int server_port)
          A frontend to connect() Initiate a connection to a server and start the
 void doDisconnect()
          Cleanup; close socket and quit running threads.
private  void doGetReaderWriter()
          A procedure that sets the global 'read' variable to wrap the socket InputStreamReader, and 'write' to wrap the socket OutputStreamWriter.
 boolean isConnected()
           
static void main(java.lang.String[] args)
          Initiate a new client instance
 void setConnected(boolean b)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

sockOut

private java.io.BufferedWriter sockOut
An output for this socket

sockIn

private java.io.BufferedReader sockIn
An input for this socket

socket

private java.net.Socket socket
The Socket on which the server communicating.

serverEchoListener

private ServerEchoListener serverEchoListener
A thread that listens on the network for server messages

userSend

private UserSend userSend
a thread that sits on the shared fifo pipe and sends messages to the server

isConnected

private boolean isConnected
A predicate that says whether we are connected
Constructor Detail

Client

public Client()
Method Detail

connect

public final java.net.Socket connect(java.lang.String server_host,
                                     int server_port)
Initiate a connection to a server
Parameters:
server_host - The server hostname
server_port - The server port number
Returns:
 

doGetReaderWriter

private final void doGetReaderWriter()
A procedure that sets the global 'read' variable to wrap the socket InputStreamReader, and 'write' to wrap the socket OutputStreamWriter.

doConnect

public final java.net.Socket doConnect(java.lang.String server_host,
                                       int server_port)
A frontend to connect() Initiate a connection to a server and start the
Parameters:
server_host - A server hostname to connect to
server_port - A server port number to connect to
Returns:
A Socket for the connection

doDisconnect

public final void doDisconnect()
Cleanup; close socket and quit running threads.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Initiate a new client instance
Parameters:
args -  
Throws:
java.io.IOException -  

isConnected

public boolean isConnected()
Returns:
 

setConnected

public void setConnected(boolean b)
Parameters:
b -