BYTEORDER(3) | Linux Programmer's Manual | BYTEORDER(3) |
名前
htonl, htons, ntohl, ntohs -ホストバイトオーダーとネットワークバイトオーダーの間で値を変換する書式
#include <arpa/inet.h>
uint32_t htonl(uint32_t hostlong );
uint16_t htons(uint16_t hostshort );
uint32_t ntohl(uint32_t netlong );
uint16_t ntohs(uint16_t netshort );
説明
htonl() 関数は unsigned integer hostlong をホストバイトオーダーからネットワークバイトオーダーに変換する。htons() 関数は unsigned short integer hostshort をホストバイトオーダーからネットワークバイトオーダーに変換する。
ntohl() 関数は unsigned integer netlong をネットワークバイトオーダーからホストバイトオーダーに変換する。
ntohs() 関数は unsigned short integer netshort をネットワークバイトオーダーからホストバイトオーダーに変換する。
i80x86 のホストバイトオーダーでは最下位バイトが若いアドレスに配置されるが、インターネットで用いられるネットワークバイトオーダーでは最上位バイトが先に配置される。
準拠
POSIX.1-2001.関連項目
endian(3), gethostbyname(3), getservent(3)この文書について
この man ページは Linux man-pages プロジェクトのリリース 3.51 の一部である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man-pages/ に書かれている。2009-01-15 | GNU |