net.listen()
Listens for TCP connections or binds a UDP endpoint.
Signature
net.listen(host, port[, options])
Parameters
Host, port and optional settings above.
Returns
TCP listener or bound UDP socket.
Behavior
Accept TCP peers separately. A UDP listener receives datagrams directly.
Errors
Invalid settings, denied network access, bind/listen error or incorrect TLS configuration.
Example
use net
s = net.listen('127.0.0.1', 0)
assert(net.local(s).port > 0)
net.close(s)