vibe.d beta banner
get vibe.d
0.10.0

Asynchronous I/O that doesn’t get in your way, written in D

listenTCP - multiple declarations

Function listenTCP

Starts listening on the specified port.

TCPListener[] listenTCP (
  ushort port,
  nothrow @safe void delegate(TCPConnection) connection_callback,
  TCPListenOptions options = TCPListenOptions.reuseAddress
) @safe;

TCPListener listenTCP (
  ushort port,
  nothrow @safe void delegate(TCPConnection) connection_callback,
  string address,
  TCPListenOptions options = TCPListenOptions.reuseAddress
) @safe;

'connection_callback' will be called for each client that connects to the server socket. Each new connection gets its own fiber. The stream parameter then allows to perform blocking I/O on the client socket.

The address parameter can be used to specify the network interface on which the server socket is supposed to listen for connections. By default, all IPv4 and IPv6 interfaces will be used.

Function listenTCP

Compatibility overload - use an @safe nothrow callback instead.

deprecated TCPListener[] listenTCP (
  ushort port,
  void delegate(TCPConnection) connection_callback,
  TCPListenOptions options = TCPListenOptions.reuseAddress
) @safe;

deprecated TCPListener listenTCP (
  ushort port,
  void delegate(TCPConnection) connection_callback,
  string address,
  TCPListenOptions options = TCPListenOptions.reuseAddress
) @safe;
Authors

Sönke Ludwig

Copyright

© 2012-2016 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.