|
||||||||||
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 that can connect to a server.
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()
|
int |
getPort()
|
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 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 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)
public Connection getConnection()
Connection
this Client
uses when
communicating with the server.
Connection
.public void disconnect()
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
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |