Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ntohs(3) — Digital UNIX 3.2c

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ntohl(3)

htonl(3)

htons(3)

ntohs(3)  —  Subroutines

NAME

ntohs − Converts an unsigned short (16-bit) integer from Internet network-byte order to host-byte order

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

#include <netinet/in.h>

unsigned short ntohs (
unsigned short netshort) ;

PARAMETERS

netshortSpecifies a 16-bit integer in host-byte order. 

DESCRIPTION

The ntohs() (network-to-host short) function converts an unsigned short (16-bit) integer from Internet network-byte order to host-byte order. 

The Internet network requires address and port reference data in network-byte order (most significant byte leftmost, least significant byte rightmost).  You can use the ntohs() function to convert Internet network address and port data to host-byte ordered integers. 

The ntohs() function is defined as a little-endian function in the netinet/in.h header file for machine environments where network-byte order and host-byte order are not identical. 

RETURN VALUES

The ntohs() function returns a 16-bit short integer in host-byte order. 

RELATED INFORMATION

Functions: ntohl(3), htonl(3), htons(3)

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