tcp_create_listener(?Address, -PassiveSocket)

tcp_create_listener/2 creates a passive socket to listen for connections. If Address is unbound, tcp_create_listener/2 establishes a listener on a dynamic port and binds Address to an address term of the form address(Port,Host). Alternatively, tcp_create_listener/2 will establish a listener on a fixed port if Address is bound to an address term with Port set to the specific port number. Note that only privileged (or root) processes can use port numbers less than 1024.

tcp_create_listener/2 returns immediately after creating the socket that is used for accepting connection requests and returns the socket identifier in PassiveSocket. Connection requests are accepted by the select predicates (see ipc-tcp-trm-select1).