|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.client.networking.Client
public final class Client
The client connection to a server.
| Field Summary | |
|---|---|
private Connection |
c
The Connection this Client uses when
communicating with the server. |
private java.lang.String |
host
|
private static java.util.logging.Logger |
logger
|
private int |
port
|
| Constructor Summary | |
|---|---|
Client(java.lang.String host,
int port,
MessageHandler handler)
Creates a new Client. |
|
| Method Summary | |
|---|---|
org.w3c.dom.Element |
ask(org.w3c.dom.Element element)
Sends the specified message to the server and returns the reply. |
void |
disconnect()
Disconnects this client from the server. |
Connection |
getConnection()
Gets the Connection this Client uses when
communicating with the server. |
java.lang.String |
getHost()
Gets the host used by the connection. |
int |
getPort()
Gets the port used by the connection. |
void |
send(org.w3c.dom.Element element)
Sends the specified message to the server. |
void |
sendAndWait(org.w3c.dom.Element element)
Sends the specified message to the server and waits for the reply to be returned before returning from this method. |
void |
setMessageHandler(MessageHandler mh)
Sets the MessageHandler for this Client. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private final Connection c
Connection this Client uses when
communicating with the server.
private java.lang.String host
private int port
| Constructor Detail |
|---|
public Client(java.lang.String host,
int port,
MessageHandler handler)
throws java.io.IOException
Client.
host - The host to connect to.port - The port to connect to.handler - The MessageHandler to use.
java.io.IOException - If an exception is thrown while creating
a new Connection.| Method Detail |
|---|
public java.lang.String getHost()
public int getPort()
public Connection getConnection()
Connection this Client uses when
communicating with the server.
Connection.public void setMessageHandler(MessageHandler mh)
MessageHandler for this Client.
The MessageHandler is the class responsible for receiving
and handling the network messages.
mh - The new MessageHandler for this client.public void disconnect()
public void send(org.w3c.dom.Element element)
element - The element (root element in a DOM-parsed XML tree) that
holds all the informationsendAndWait(Element),
ask(Element)public void sendAndWait(org.w3c.dom.Element element)
element - The element (root element in a DOM-parsed XML tree) that
holds all the informationsend(Element),
ask(Element)public org.w3c.dom.Element ask(org.w3c.dom.Element element)
element - The element (root element in a DOM-parsed XML tree)
that holds all the information
null if either
an error occured or the server did not send a reply.sendAndWait(org.w3c.dom.Element),
send(org.w3c.dom.Element)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||