Skip to main content

inet_addr

Function inet_addr 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn inet_addr(cp: *const c_char) -> in_addr_t
๐Ÿ‘ŽDeprecated
Expand description

See https://pubs.opengroup.org/onlinepubs/9799919799/functions/inet_addr.html.

Converts the string pointed to by cp, in the standard IPv4 dotted decimal notation, to an integer value suitable for use as an Internet address.

ยงDeprecated

The inet_addr() function was marked obsolescent in the Open Group Base Specifications Issue 8.

Applications should prefer inet_pton() over inet_addr() for the following reasons:

  • The return value from inet_addr() when converting 255.255.255.255 is indistinguishable from an error.
  • The inet_pton() function supports multiple address families.
  • The alternative textual representations supported by inet_addr() (but not inet_pton()) are often used maliciously to confuse or mislead users (e.g, for phishing).