|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.mischiefbox.dmud.net.Listener
Listens for new connections. Passes connections to the connection handler for lifecycle management.
| Field Summary | |
protected int |
BACKLOG
The maximum number of un-accepted connections queued. |
protected boolean |
bListening
Flag to indicate listening for new connections. |
protected ConnectionHandler |
handler
The connection handler which gets new socket connections. |
protected int |
iPort
The port on which to listen for new connections. |
protected ServerSocket |
server
The server socket. |
protected static int |
SLEEP_MILLIS
The number of milliseconds to sleep between servicing each new socket request. |
static String |
THREAD_NAME
Listener thread name. |
| Constructor Summary | |
Listener(ConnectionHandler handler,
int iPort)
Create a new Listener. |
|
| Method Summary | |
boolean |
isListening()
Indicate if this is listening. |
void |
run()
Listen for new connections and pass them to the connection handler. |
void |
start()
Start listening. |
void |
stop()
Stop listening. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String THREAD_NAME
protected static final int SLEEP_MILLIS
protected ServerSocket server
protected int iPort
protected int BACKLOG
protected ConnectionHandler handler
protected boolean bListening
| Constructor Detail |
public Listener(ConnectionHandler handler,
int iPort)
handler - the connection handler.iPort - the port on which to listen.| Method Detail |
public boolean isListening()
public void start()
public void stop()
public void run()
run in interface Runnable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||