Inet_aton () is a 32-bit IP address in the byte sequence of the network.
Syntax:
# Include <sys/socket. h>
# Include <netinet/in. h>
# Include <ARPA/inet. h>
Int inet_aton (const char * string, struct in_addr * ADDR );
Convert the IP address in the Set interface into a string in dotted-decimal format. The syntax is as follows:
# Include <sys/socket. h>
# Include <netinet/in. h>
# Include <ARPA/inet. h>
Char * inet_ntoa (struct in_addr ADDR );
Converts an IP address in dotted decimal format to a 32-bit binary IP address in the host's byte sequence. The syntax is as follows:
# Include <sys/socket. h>
# Include <netinet/in. h>
# Include <ARPA/inet. h>
Unsigned long inet_network (const char * ADDR );
The results returned in the byte order of the host can ensure that the user uses the network mask safely. If the returned value is in the network byte order, the network mask and program code used for different CPU platforms are different.
Convert the IP address (Network byte) in the Set interface address to the host ID (host byte) without network bits ). Syntax:
# Include <sys/socket. h>
# Include <netinet/in. h>
# Include <ARPA/inet. h>
Unsigned long inet_lnaof (struct in_addr ADDR );
For example, inet_lnaof (192.168.9.1) = 0.0.0.1
Different from the preceding function, inet_lnaof () returns the host ID, while inet_netof () returns the network ID. Syntax:
# Include <sys/socket. h>
# Include <netinet/in. h>
# Include <ARPA/inet. h>
Unsigned long inet_netof (struct in_addr ADDR );
For example, inet_netof (192.168.9.1) = 0.192.168.9
Combine the extracted network and host locations to generate a new IP address. Syntax:
# Include <sys/socket. h>
# Include <netinet/in. h>
# Include <ARPA/inet. h>
Struct in_addr inet_makeaddr (INT net, int host );
Net represents the network bit, and host represents the host bit