#include <netinet/in.h> UNIX

Posted on 2012-03-16 01:10  无忧consume  阅读(1441)  评论(0编辑  收藏  举报

NAME

netinet/in.h - Internet Protocol family

SYNOPSIS

 #include <netinet/in.h> 

DESCRIPTION

When header file <netinet/in.h> is included, the following types are defined through typedef.

 

in_port_t
An unsigned integral type of exactly 16 bits.
in_addr_t
An unsigned integral type of exactly 32 bits.

The <netinet/in.h> header defines the in_addr structure that includes at least the following member:

 in_addr_t s_addr 

The <netinet/in.h> header defines the sockaddr_in structure that includes at least the following member:

 sa_family_t sin_family in_port_t sin_port struct in_addr sin_addr unsigned char sin_zero[8] 
The sockaddr_in structure is used to store addresses for the Internet protocol family. Values of this type must be cast to struct sockaddr for use with the socket interfaces defined in this document.

The <netinet/in.h> header defines the type sa_family_t as described in <sys/socket.h>.

The <netinet/in.h> header defines the following macros for use as values of the level argument of getsockopt() and setsockopt():

IPPROTO_IP
Dummy for IP.
IPPROTO_ICMP
Control message protocol.
IPPROTO_TCP
TCP.
IPPROTO_UDP
User datagram protocol.

The <netinet/in.h> header defines the following macros for use as destination addresses for connect()sendmsg() and sendto():

INADDR_ANY
Local host address.
INADDR_BROADCAST
Broadcast address.

ntohl()ntohs()htonl() and htons() as defined in the description of <arpa/inet.h> are available. Inclusion of the <netinet/in.h> header may also make visible all symbols from <arpa/inet.h>.

SEE ALSO

getsockopt()setsockopt()<sys/socket.h>.

Copyright © 2024 无忧consume
Powered by .NET 9.0 on Kubernetes