BYTEORDER

Section: Linux Programmer's Manual (3)
Updated: 2017-09-15
Index JM Home Page
 

名前

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 のホストバイトオーダーでは最下位バイトが若いアドレスに配置されるが、 インターネットで用いられるネットワークバイトオーダーでは最上位バイト が先に配置される。  

属性

この節で使用されている用語の説明は attributes(7) を参照のこと。
Interface Attribute Value
htonl(), htons(), ntohl(), ntohs() Thread safety MT-Safe
 

準拠

POSIX.1-2001, POSIX.1-2008.

いくつかのシステムでは、 <arpa/inet.h> の代わりに <netinet/in.h> をインクルードする必要がある。  

関連項目

bswap(3), endian(3), gethostbyname(3), getservent(3)  

この文書について

この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。

関連キーワード

uint, BYTEORDER, ネットワークバイトオーダー, ホストバイトオーダー, 変換, 関数, integer, ntohs, ntohl, htons

Linux マニュアル 一覧

[man1] [man2] [man3] [man4] [man5] [man6] [man7] [man8]
[a] [b] [c] [d] [e] [f] [g] [h] [i] [j] [k] [l] [m] [n] [o] [p] [q] [r] [s] [t] [u] [v] [w] [x] [y] [z]

 

Index

名前
書式
説明
属性
準拠
関連項目
この文書について

This document was created by man2html, using the manual pages.
Time: 12:08:43 GMT, June 11, 2022