|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcontext.arch.comm.protocol.TCPServerSocket
This class implements a threaded serversocket that accepts TCP packets. It does nothing with the TCP packets themselves but can be subclassed to do real work. Whenever it receives data, it clones itself. The original class listens for more new connections while the clone handles the received data.
Runnable,
Cloneable| Field Summary | |
static boolean |
DEBUG
Debug flag. |
static int |
DEFAULT_PORT
The default port number to use is 5555 |
| Constructor Summary | |
TCPServerSocket()
Default constructor for TCPServerSocket, with the default port. |
|
TCPServerSocket(int port)
TCPServerSocket constructor with user-specified port. |
|
| Method Summary | |
void |
handleIncomingRequest(java.net.Socket data)
This method handles data received on a given TCPServerSocket. |
void |
run()
This method loops forever waiting for data on the socket. |
void |
start()
Starts a ServerSocket and a thread with this TCPServerSocket as the Runnable. |
void |
stopServer()
Stops the original thread (just the original?) running and closes the socket. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static boolean DEBUG
public static final int DEFAULT_PORT
| Constructor Detail |
public TCPServerSocket()
DEFAULT_PORTpublic TCPServerSocket(int port)
port - Port number to use| Method Detail |
public void start()
public void stopServer()
public void run()
run in interface java.lang.RunnablehandleIncomingRequest(java.net.Socket)public void handleIncomingRequest(java.net.Socket data)
data - Socket the data is arriving on
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||