IN_ADDR structure (inaddr.h)

The in_addr structure represents an IPv4 address.

Note  The IPaddr type definition in IP Helper also represents an IPv4 address and can be cast to an interchangeable in_addr structure when needed. The in_addr structure in IP Helper has the same syntax and usage as the Windows Sockets in_addr structure, and is interchangeable with in_addr structure used in Windows sockets. Windows sockets also defines an IN_ADDR typedef for the in_addr structure.
 

Syntax

typedef struct in_addr {
  union {
    struct {
      UCHAR s_b1;
      UCHAR s_b2;
      UCHAR s_b3;
      UCHAR s_b4;
    } S_un_b;
    struct {
      USHORT s_w1;
      USHORT s_w2;
    } S_un_w;
    ULONG S_addr;
  } S_un;
} IN_ADDR, *PIN_ADDR, *LPIN_ADDR;

Members

S_un

S_un.S_un_b

The IPv4 address of the host 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

The IPv4 address of the host formatted as two u_shorts.

S_un.S_un_w.s_w1

S_un.S_un_w.s_w2

S_un.S_addr

Address of the host formatted as a u_long.

Remarks

The IPaddr type definition also represents an IPv4 address and can be cast to an in_addr structure when needed.

On the Microsoft Windows Software Development Kit (SDK) released for Windows Vista and later, the organization of header files has changed and the in_addr structure is defined in the Inaddr.h header file which is automatically included by the Ipexport.h header file. On the Platform Software Development Kit (SDK) released for Windows Server 2003 and Windows XP, the in_addr structure is declared in the Ipexport.h header file.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Header inaddr.h (include Ipexport.h)

See also

ARP_SEND_REPLY

AddIPAddress

GetBestInterface

GetRTTAndHopCount

ICMP_ECHO_REPLY

IP_UNIDIRECTIONAL_ADAPTER_ADDRESS

IcmpSendEcho

IcmpSendEcho2

SendARP

in_addr(Winsock)