UDT Reference: UDT Functions |
The bind method associates an socket with a local address.
int bind( |
If the binding is successful, bind returns 0, otherwise it returns UDT::ERROR and the specific error information can be retrieved using getlasterror.
Error Code | Comment |
---|---|
5001 |
u has already been bound to a certain address. |
5003 |
the address is either invalid or unavailable. |
5004 |
u is an invalid UDT socket. |
The bind method is usually used to assign a UDT socket a local address, including the IP version, local IP address, and port number. This is not necessary in all cases, except that before a listen call, a socket must be bound.
If the bind method is not called by applications, the socket will be bound to any available address automatically when connect is called.