IPSocket.bind

Assigns a local address and optionally a port to this socket. This socket needs to have been created by socket().

  1. int bind(InAddr local_address)
  2. int bind(cstring local_ip_address, ushort local_port)
    class IPSocket(bool IPv6 = false)
    int
    bind
  3. int bind(ushort local_port)
  4. int bind(sockaddr* local_address)

Parameters

local_ip_address cstring

local IP address

local_port ushort

local port or 0 to use the wildcard "any" port

Return Value

Type: int

0 on success or -1 on failure. On failure errno is set appropriately.

Errors: as above but also sets errno to EAFNOSUPPORT if the address does not contain a valid IP address string.

Meta