startServer

Start a socket server, call back for each client connected.

The first parameter, $(D_PSYMBOL clientConnectedCallback), takes two parameters: $(D_PSYMBOL clientReader), $(D_PSYMBOL clientWriter). $(D_PSYMBOL clientReader) is a $(D_PSYMBOL StreamReader) object, while $(D_PSYMBOL clientWriter) is a $(D_PSYMBOL StreamWriter) object. This parameter is a coroutine, that will be automatically converted into a $(D_PSYMBOL Task).

The rest of the arguments are all the usual arguments to $(D_PSYMBOL eventLoop.createServer()) except $(D_PSYMBOL protocolFactory). The return value is the same as $(D_PSYMBOL eventLoop.createServer()).

Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the $(D_PSYMBOL StreamReader)).

The return value is the same as $(D_PSYMBOL loop.createServer()), i.e. a $(D_PSYMBOL Server) object which can be used to stop the service.

@Coroutine
startServer
(
,
ClientConnectedCallback clientConnectedCallback
,
in char[] host = null
,
in char[] service = null
,
size_t limit = DEFAULT_LIMIT
,
AddressFamily addressFamily = UNSPECIFIED!AddressFamily
,
AddressInfoFlags addressInfoFlags = AddressInfoFlags.PASSIVE
,
Socket socket = null
,
int backlog = 100
,
SslContext sslContext = null
,
bool reuseAddress = true
)

Meta