To accept connections, a socket is first created with socket(). A backlog for incoming connections is specified with listen() and then the connections are accepted with accept(). The listen() call applies only to sockets of type SOCK_STREAM. The backLog parameter defines the maximum length the queue of pending connections may grow to. If a connection request arrives with the queue full, and the underlying protocol supports retransmission, the connection request may be ignored so that retries may succeed. For AF_INET sockets, TCP will retry the connection. If the backlog is not cleared by the time the TCP times out, connect() will fail with TM_ETIMEDOUT.
- The socket descriptor to listen on.
- The maximum number of outstanding connections allowed on the socket.
|Note:|| TM_SOCKET_ERROR means that this socket call has failed and the errorCode has been set on the socket itself.
To retrieve the socket error the user must call tfGetSocketError(socketDescriptor).
Possible socket errors
- The address is currently used by another socket.
- The socket descriptor is invalid.
- The socket is not of a type that supports the listen() operation.