|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
server.Client
public abstract class Client
A general client class for connecting to a server instance
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Client()
|
|
| Method Summary | |
|---|---|
void |
connect(java.lang.String address)
connect to a server and open the default port |
boolean |
connect(java.lang.String address,
int localPort)
connect to a server and specifies a port to open up |
void |
disconnect()
disconnect from the server |
java.lang.String |
getAddress()
Get the address of the client |
boolean |
isConnected()
Check if the clinet is connected |
void |
ping()
send a packet receive a packet |
void |
run()
be ready to receive packets |
void |
sendString(java.lang.String cmd)
send a string to the server |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Client()
| Method Detail |
|---|
public void connect(java.lang.String address)
throws java.io.IOException
address - the address of the server it should send data to
java.io.IOException
public boolean connect(java.lang.String address,
int localPort)
throws java.io.IOException
address - the address of the server it should send data tolocalPort - the local port to open
java.io.IOExceptionpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void ping()
public void disconnect()
throws java.io.IOException
java.io.IOException
public void sendString(java.lang.String cmd)
throws java.io.IOException
cmd - the string to send to the server
java.io.IOExceptionpublic java.lang.String getAddress()
public boolean isConnected()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||