EventLoop.createServer

A coroutine which creates a TCP server bound to host and port.

class EventLoop
createServer
(,
in char[] host = null
,
in char[] service = null
,
AddressFamily addressFamily = UNSPECIFIED!AddressFamily
,
AddressInfoFlags addressInfoFlags = AddressInfoFlags.PASSIVE
,
Socket socket = null
,
int backlog = 100
,,
bool reuseAddress = true
)

Parameters

protocolFactory ProtocolFactory

is a callable returning a protocol instance.

host char[]

if empty then all interfaces are assumed and a list of multiple sockets will be returned (most likely one for IPv4 and another one for IPv6).

service char[]

service name or port number.

addressFamily AddressFamily

can be set to either $(D_PSYMBOL AddressFamily.INET) or $(D_PSYMBOL AddressFamily.INET6) to force the socket to use IPv4 or IPv6. If not set it will be determined from host (defaults to $(D_PSYMBOL AddressFamily.UNSPEC)).

addressInfoFlags AddressInfoFlags

a bitmask for getAddressInfo().

socket Socket

can optionally be specified in order to use a preexisting socket object.

backlog int

the maximum number of queued connections passed to listen() (defaults to 100).

sslContext SslContext

can be set to an SSLContext to enable SSL over the accepted connections.

reuseAddress bool

tells the kernel to reuse a local socket in TIME_WAIT state, without waiting for its natural timeout to expire. If not specified will automatically be set to $(D_KEYWORD true) on UNIX.

Return Value

Type: Server

a Server object which can be used to stop the service.

Meta