|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.util.ExceptionIgnorer
org.pf.net.PortListener
public class PortListener
Encapsulates the functionality to open a port (i.e. server socket) and start listening on it.
| Constructor Summary | |
|---|---|
PortListener(int port)
Initialize the new instance with the given port. |
|
PortListener(int port,
ExceptionHandler handler)
Initialize the new instance with the given port and exception handler. |
|
| Method Summary | |
|---|---|
void |
close()
Close the underlying socket. |
int |
getPort()
Returns the port number this port listener is listening on. |
boolean |
isOpen()
Returns true if the server socket is open and can be used. |
java.net.Socket |
waitForRequest()
Listen to the port until a request comes in and return the newly created socket that can be used to handle the request. |
| Methods inherited from class org.pf.util.ExceptionIgnorer |
|---|
exceptionOccurred, getExceptionHandler, setExceptionHandler |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PortListener(int port)
public PortListener(int port,
ExceptionHandler handler)
| Method Detail |
|---|
public java.net.Socket waitForRequest()
If the socket is not opened yet then null will be returned.
public void close()
public boolean isOpen()
public int getPort()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||