- Index
- »
- inet
- »
- TcpListener
type
TcpListener
TcpListener is a server socket that listens to a local well known port for incoming TcpSockets.
constructors
make |
Create a new, unbound TCP server socket. |
---|
methods
accept |
Accept the next incoming connection. |
---|---|
bind |
Bind this listener to the specified local address. |
close |
Close this server socket. |
config |
The |
isBound |
Is this socket bound to a local address and port. |
isClosed |
Is this socket closed. |
localAddr |
Get the bound local address or null if unbound. |
localPort |
Get the bound local port or null if unbound. |
options |
Access the SocketOptions used to tune this server socket. |
Slot Details
accept
Accept the next incoming connection. This method blocks the calling thread until a new connection is established. If this listener's SocketConfig.acceptTimeout
is configured, then accept will timeout with an IOErr.
bind
src
This bind(IpAddr? addr, Int? port, Int backlog := 50)
Bind this listener to the specified local address. If addr is null then the default IpAddr for the local host is selected. If port is null an ephemeral port is selected. Throw IOErr if the port is already bound or the bind fails. Return this.
close
config
src
SocketConfig config()
The SocketConfig
being used to configure the server sockets.
isBound
isClosed
localAddr
localPort
make
src
new make(SocketConfig config := SocketConfig.cur())
Create a new, unbound TCP server socket. The socket will be configured using the given socket configuration
. The following configuration applies to listeners:
options
src
@Deprecated { msg="Use SocketConfig" }
SocketOptions options()
Access the SocketOptions used to tune this server socket. The following options apply to TcpListeners:
- receiveBufferSize
- reuseAddr Accessing other option fields will throw UnsupportedErr.