Function startServer
Start a socket
server, call back for each client connected.
The first parameter, clientConnectedCallback
, takes two
Prototype
Server startServer(
EventLoop eventLoop,
void delegate(asynchronous .streams .StreamReader, StreamWriter) clientConnectedCallback,
const(char[]) host = null,
const(char[]) service = null,
ulong limit = 65536LU,
std .socket .AddressFamily addressFamily = UNSPECIFIED(),
std .socket .AddressInfoFlags addressInfoFlags = cast(AddressInfoFlags)1,
std .socket .Socket socket = null,
int backlog = 100,
asynchronous .events .SslContext sslContext = null,
bool reuseAddress = true
);
parameters
clientReader, clientWriter. clientReader is a StreamReader object, while clientWriter is a StreamWriter
object. This parameter is a
coroutine, that will be automatically converted into a Task.
The rest of the arguments are all the usual arguments to eventLoop.createServer() except protocolFactory. The return value is the same as 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
StreamReader).
The return value is the same as loop.createServer(), i.e. a
Server object which can be used to stop the service
.
Authors
Dragos Carp
Copyright
© 2015-2016 Dragos Carp
License
Boost Software License - Version 1.0