public abstract class SocketListener
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
SocketListener.SocketListenerFactory |
Modifier | Constructor and Description |
---|---|
protected |
SocketListener(SocketConnectionHandler socketConnectionHandler,
int port) |
Modifier and Type | Method and Description |
---|---|
static SocketListener |
createTcpSocketListener(SocketConnectionHandler socketConnectionHandler,
int port)
Create TCP SocketListener, using the global factory.
|
int |
getPort()
Get the port.
|
SocketConnectionHandler |
getSocketConnectionHandler() |
static void |
setFactory(SocketListener.SocketListenerFactory socketListenerFactory)
Set the global (default) factory used to create SocketListeners.
|
void |
setPort(int port)
Set the port, overriding what was previously set.
|
abstract void |
start() |
abstract void |
stop() |
protected SocketListener(SocketConnectionHandler socketConnectionHandler, int port)
public static SocketListener createTcpSocketListener(SocketConnectionHandler socketConnectionHandler, int port)
socketConnectionHandler
- connection handler, to receive incoming connectionsport
- port number to listen onpublic static void setFactory(@Nullable SocketListener.SocketListenerFactory socketListenerFactory)
socketListenerFactory
- socket listener factorypublic SocketConnectionHandler getSocketConnectionHandler()
public int getPort()
public void setPort(int port)
port
- port numberpublic abstract void start()
public abstract void stop()