Cold Help System: Programming: ColdC Reference Manual: Functions: Network: bind_port()


INTEGER bind_port(INTEGER port[, STRING addr])

This function binds a network port to the current object. If successful, the current object will receive connections on the port. The first argument specifies the port to bind to. Positive port numbers represent the TCP protocol. Negative port numbers represent the UDP protocol. The second optional argument is the address to bind to, which must be a standard IP address (not an internet domain name). This is usually not required, but can be useful if multiple addresses exist on the system and only one must be bound.

If the port is pre-bound (see the Genesis documentation) but the address does not match up, the error ~preaddr may be thrown. If the port is pre-bound and the protocols do not match, the error ~pretype is thrown. If the given address is not a valid IP address the error ~address is thrown. Other errors may be thrown as ~socket or ~bind if other problems arise.


bind_port() | close_connection() | connection() | cwrite() | cwritef() | open_connection() | reassign_connection() | unbind_port()


the Cold Dark