Algorithm of creating a server socket of type @c SOCK_STREAM

  1. Call socket() on srvr PCO with the following parameters: domain, SOCK_STREAM, proto. Created socket is referred as srvr_s below;

  2. If srvr_wild is true, fill in network address part of srvr_bind_addr with wildcard network address;

  3. Copy port part of srvr_addr to port part of srvr_bind_addr address;

  4. Bind srvr_s socket to srvr_bind_addr address.

  5. If port part of srvr_addr is zero (not specified), then call getsockname() on srvr_s socket to obtain the assigned port and set it to the port part of srvr_addr.

  6. Call listen() for srvr_s socket with default backlog.