public interface Acceptor extends AutoCloseable
Modifier and Type | Interface and Description |
---|---|
static interface |
Acceptor.Listener
The interface represents a listener for handling accept events.
|
Modifier and Type | Field and Description |
---|---|
static Acceptor.Listener |
NULL_LISTENER
This field represents a null implementation of the
Acceptor.Listener interface. |
Modifier and Type | Method and Description |
---|---|
void |
addListeningPort(InetSocketAddress bindAddress,
Object attachment)
Creates a server-socket bound to the specified address.
|
Acceptor.Listener |
getListener()
Returns the listener which will be called in case there is a new connection accepted on a listening port.
|
boolean |
removeListeningPort(int port)
Removes the server-socket corresponding to the port number.
|
void |
setListener(Acceptor.Listener listener)
Sets the listener which will be called in case there is a new connection accepted on a listening port.
|
close
static final Acceptor.Listener NULL_LISTENER
Acceptor.Listener
interface.Acceptor.Listener getListener()
void setListener(Acceptor.Listener listener)
listener
- listener to be used when a new connection accepted.void addListeningPort(InetSocketAddress bindAddress, Object attachment) throws IOException
bindAddress
- address created server-socket will be bound.attachment
- attachment which will be returned when a new connection will be accepted.IOException
- will be thrown in case there is a exception while binding/configuring server-socket.boolean removeListeningPort(int port) throws IOException
port
- port numbertrue
in case corresponding server-socket is removed, false
otherwise.IOException
- will be thrown in case there is a exception while unbinding/closing server-socket.Copyright © 2005–2024 Onix Solutions. All rights reserved.