UDT Reference: CUDT Methods

listen

The listen method enables a server UDT entity to wait for the peer side to connect to it.

void listen(

   const int& timeo = 0

);

Parameters

timeo
[in] The time (in microseconds) to wait before a successful connection.

Return Values

NONE.

Exceptions

Exception will be threw out if no client tried to connect before timer expires (if timeo is greater than 0).

Description

The listen method waits for the client side to connect to construct a UDT connection. If timeo is not greater than 0, the server can be blocked forever if there is no client side connect to it. Otherwise, it exit with a connection failure exception if the timer expires.

Once it receives a handshake packet from a client, the two peer sides exchanges the information such as maximum flow window size and MTU. All values are selected to be the smaller one.

The sending and receiving threads are started after listen, and the UDT entity is ready for data transfer.

See Also

open, connect