UDT Reference: Functions

#### listen

The listen method enables a server UDT entity to wait for clients to connect.

int list(
UDTSOCKET u
int backlog
);

##### Parameters

u
  [in] Descriptor identifying the server socket.
backlog
  [in] Maximum number of pending connections.

##### Return Value

If success, 0 is returned; otherwise, UDT::ERROR is returned and specific error information can be retrieved by getlasterror.

Error Name | Error Code | Comment
ECONNSOCK | 5002 | u is already connected.
EINVSOCK | 5004 | u is an invalid socket.
EUNBOUNDSOCK | 5005 | u is not bound.
ERDVNOSERV | 5007 | u is in rendezvous mode.

##### Description

The listen method lets a UDT socket enter listening state. The socket must call bind before a listen call. In addition, if the socket is enable for rendezvous mode, neither listen nor accept can be used on the socket. A UDT socket can call listen more than once, in which case only the first call is effective, while all subsequent calls will be ignored if the socket is already in listening state.

##### See Also

bind, accpet, connect