1.
函數用途:數字網絡序本地序轉換
適用類型:IP地址uint32_t類型、端口號uint16_t類型
#include<netinet/in.h> extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__)); extern uint16_t ntohs (uint16_t __netshort) __THROW __attribute__ ((__const__)); extern uint32_t htonl (uint32_t __hostlong) __THROW __attribute__ ((__const__)); extern uint16_t htons (uint16_t __hostshort) __THROW __attribute__ ((__const__));
2.
函數用途:點分十進制IP地址的字符串轉換為網絡序二進制數
適用類型:XXX.XXX.XXX.XXX轉uint32_t類型
#include<apra/inet.h> extern in_addr_t inet_addr (const char *__cp) __THROW; extern int inet_aton (const char *__cp, struct in_addr *__inp) __THROW; extern char *inet_nsap_ntoa (int __len, const unsigned char *__cp, char *__buf) __THROW;