ConnectedSocket.listen

Create a stream socket and bind, as a listening server, to the address supplied

This creates a TCP socket (or equivalent for the address family). It binds it to the designated address specified in sa, and puts it in listening mode.

  1. ConnectedSocket listen(SockAddr sa, bool reuseAddr)
    struct ConnectedSocket
    static @trusted @nogc
    listen
    (
    SockAddr sa
    ,
    bool reuseAddr = false
    )
  2. ConnectedSocket listen(SA sa, bool reuseAddr)

Parameters

sa SockAddr

a socket address for the server to listen on. The second form is for passing protocol specific addresses (SockAddrIPv4, SockAddrIPv6, SockAddrUnix).

reuseAddr bool

Whether to set the SO_REUSEADDR socket option

Return Value

Returns the listening socket.

Throws

ErrnoException if the connection fails (e.g. - EADDRINUSE if binding to a used port). Also throws this if one of the system calls fails.

Meta