listen/2 is a direct link to the listen(2) socket system call. Stream must be a socket stream created with socket/3 of the type stream. Queue specifies the length of the connection queue, i.e. how many connections are allowed for this socket. After the call to listen/2, other processes can call connect/2 to connect with this socket, but the I/O is possible only after the server process creates the new socket using accept/3.
Stream sockets are connected using the standard sequence, i.e. socket/3, bind/2, listen/2 and accept/3 on the server and socket/3 and connect/2 on the client. After the sockets are connected, both processes can use them for reading and writing.
Success: socket(internet, stream, s), bind(s, Addr), listen(s, 1). Error: listen(s, N) (Error 4). listen(s, 1.0) (Error 5). listen(null, 2) (Error 170).