Class COM.roguewave.jchat.Connection
All Packages Class Hierarchy This Package Previous Next Index
Class COM.roguewave.jchat.Connection
java.lang.Object
|
+----COM.roguewave.jchat.Connection
- public class Connection
- extends Object
The Connection class.
The Connection class adds a layer of abstraction to a socket-pair relationship.
There must be two instances of a Connection, one on the server and one on the
client. The setClient() and setServer() methods are provided to specify whether
a particular instance of a Connection is a client or a server.
A Connection instantiates a Reader that will notify a Dispatcher implementation when
a complete command is received.
- See Also:
- Dispatcher, Reader
-
Connection(Socket, Dispatcher)
- Creates a Connection on the specified socket.
-
close()
- Safely close the Connection.
-
getUser()
- Return the user of this connection.
-
send(String[])
- Send an array of strings across the socket.
-
send(String)
- Send a String across the socket.
-
setClient(String)
- Specify that this instance of the Connection is for the client.
-
setServer()
- Specify that this instance of the Connection is for the server.
Connection
public Connection(Socket aSocket,
Dispatcher aDispatcher)
- Creates a Connection on the specified socket. The specified Dispatcher is
notified when a complete command is read from the socket.
setClient
public void setClient(String aUser)
- Specify that this instance of the Connection is for the client. A name
representing a user is a required parameter.
setServer
public void setServer()
- Specify that this instance of the Connection is for the server.
getUser
public String getUser()
- Return the user of this connection.
- Returns:
- Returns a String representing the user of this connection.
send
public synchronized void send(String data[])
- Send an array of strings across the socket.
send
public synchronized void send(String data)
- Send a String across the socket.
close
public synchronized void close()
- Safely close the Connection.
All Packages Class Hierarchy This Package Previous Next Index