public class Client
extends java.lang.Object
| Constructor and Description |
|---|
Client()
Instantiates a new client.
|
Client(java.net.Socket socket)
Instantiates a new client.
|
Client(java.lang.String host)
Create a new Client connection, connection to the given hostname which is of the form:
hostname[:optional port number].
|
Client(java.lang.String host,
int thePort)
Create a new Client connection, connection to the given hostname which is of the form:
hostname[:optional port number].
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
_more_
|
void |
debug(java.lang.String msg)
Debug
|
java.lang.String |
getHostname()
Get the Hostname property.
|
boolean |
getOkToReceive()
Get the OkToReceive property.
|
boolean |
getOkToSend()
Get the OkToSend property.
|
boolean |
getValid()
Get the Valid property.
|
protected void |
handleServerMessage(java.lang.String message)
Handle the message rcvd from the server.
|
boolean |
isConnectionOk()
Is this client currently connected.
|
protected void |
logException(java.lang.String msg,
java.lang.Exception exc)
Log exception.
|
static void |
main(java.lang.String[] args)
The main method.
|
protected java.lang.String |
read()
Read.
|
void |
setHostname(java.lang.String value)
Set the Hostname property.
|
void |
setOkToReceive(boolean value)
Set the OkToReceive property.
|
void |
setOkToSend(boolean value)
Set the OkToSend property.
|
void |
setValid(boolean value)
Set the Valid property.
|
java.lang.String |
toString() |
void |
write(java.lang.String message)
Write.
|
public Client()
public Client(java.lang.String host)
host - the hostpublic Client(java.lang.String host,
int thePort)
host - the hostthePort - the the portpublic Client(java.net.Socket socket)
throws java.io.IOException
socket - the socketjava.io.IOException - Signals that an I/O exception has occurred.public void debug(java.lang.String msg)
msg - debug messagepublic boolean isConnectionOk()
protected void handleServerMessage(java.lang.String message)
message - message from serverprotected java.lang.String read()
throws java.io.IOException
java.io.IOException - Signals that an I/O exception has occurred.public void close()
public void write(java.lang.String message)
message - the messageprotected void logException(java.lang.String msg,
java.lang.Exception exc)
msg - the msgexc - the excpublic java.lang.String toString()
toString in class java.lang.Objectpublic void setHostname(java.lang.String value)
value - The new value for Hostnamepublic java.lang.String getHostname()
public void setValid(boolean value)
value - The new value for Validpublic boolean getValid()
public void setOkToSend(boolean value)
value - The new value for OkToSendpublic boolean getOkToSend()
public void setOkToReceive(boolean value)
value - The new value for OkToReceivepublic boolean getOkToReceive()
public static void main(java.lang.String[] args)
args - the arguments