InetAddress.inet_pton

Sets the address field (sin_addr/sin6_addr) of this.addr to the address in ip_address_str. ip_address_str is expected be a NUL-terminated string.

  1. int inet_pton(cstring ip_address_str)
  2. int inet_pton(char* ip_address_str)
    struct InetAddress(bool IPv6 = false)
    int
    inet_pton
    ()

Parameters

ip_address_str char*

input IP address string

Return Value

Type: int

1 on success or 0 if src does not contain a valid IP address.

(Note: The inet_pton() specs say it can return -1 with errno = EAFNOSUPPORT; this is not possible unless there is a bug in this struct template ;)

Meta