Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ntohl(3N) — NEWS-os 3.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

gethostbyname(3N)

getservent(3N)

BYTEORDER(3N)  —  UNIX Programmer’s Manual

名称

htonl, htons, ntonhl, ntohs  −  ホストとネットワーク上でのバイトオーダの変換

形式

#include <sys/types.h>
#include <netinet/in.h>

netlong = htonl(hostlong);
u_long netlong, hostlong;

netshort = htons(hostshort);
u_short netshort, hostshort;

hostlong = ntohl(netlong);
u_long hostlong, netlong;

hostshort = ntohs(netshort);
u_short hostshort, netshort;

解説

これらのルーチンは、 ネットワークのバイトオーダとホストのバイトオーダの間で、 16 ビットと 32 ビットを変換します。 NEWSのようなマシン上では、 これらのルーチンは、 インクルードファイル <netinet/in.h> 中で、 ナルマクロとして定義されています。

これらのルーチンは、 gethostbyname(3N) と getservent(3N) が返すような、 インターネットのアドレスとポートの接続において、 最もよく使用されます。

関連事項

gethostbyname(3N), getservent(3N)

注意

VAX は世界中の他のほとんどのコンピュータとは逆にバイトを扱います。 これは近い将来にも修正される予定はありません。

NEWS-OSRelease 3.3

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026