in_addr structure (winsock2.h)

The in_addr structure represents an IPv4 Internet address.

Syntax

struct in_addr {
  union {
    struct {
      u_char s_b1;
      u_char s_b2;
      u_char s_b3;
      u_char s_b4;
    } S_un_b;
    struct {
      u_short s_w1;
      u_short s_w2;
    } S_un_w;
    u_long S_addr;
  } S_un;
};

Members

S_un

S_un.S_un_b

An IPv4 address formatted as four u_chars.

S_un.S_un_b.s_b1

S_un.S_un_b.s_b2

S_un.S_un_b.s_b3

S_un.S_un_b.s_b4

S_un.S_un_w

An IPv4 address formatted as two u_shorts.

S_un.S_un_w.s_w1

S_un.S_un_w.s_w2

S_un.S_addr

An IPv4 address formatted as a u_long.

Remarks

The in_addr structure is used with IPv4 addresses.

The in_addr structure is the IPv4 equivalent of the IPv6-based in6_addr structure.

Note  The IN_ADDR, PIN_ADDR, and LPIN_ADDR derived structures are only defined on the Windows SDK released with Windows Vista and later. The IN_ADDR, PIN_ADDR, and LPIN_ADDR derived structures are defined in the Inaddr.h header file. On earlier versions of the Windows SDK, variables of this type should be declared as struct in_addr.
 

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header winsock2.h

See also

in6_addr

inet_addr

inet_ntoa

sockaddr