[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Technical Reference, Volume 2

ntohl Subroutine

Purpose

Converts an unsigned long integer from Internet network standard byte order to host byte order.

Library

ISODE Library (libisode.a)

Syntax

#include <sys/types.h>
#include <netinet/in.h>
unsigned long ntohl (NetLong)
unsigned long NetLong;

Description

The ntohl subroutine converts an unsigned long (32-bit) integer from Internet network standard byte order to host byte order.

Receiving hosts require addresses and ports in host byte order. Use the ntohl subroutine to convert Internet addresses and ports to the host integer representation.

The ntohl subroutine is defined in the net/nh.h file as a macro.

Parameters

NetLong Requires a 32-bit integer in network byte order.

Return Values

The ntohl subroutine returns a 32-bit integer in host byte order.

Implementation Specifics

The ntohl subroutine is part of Base Operating System (BOS) Runtime.

All applications containing the ntohl subroutine must be compiled with _BSD set to a specific value. Acceptable values are 43 and 44. In addition, all socket applications must include the BSD libbsd.a library.

Related Information

The endhostent subroutine, endservent subroutine, gethostbyaddr subroutine, gethostbyname subroutine, getservbyname subroutine, getservbyport subroutine, getservent subroutine, htonl subroutine, htons subroutine, ntohs subroutine, sethostent subroutine, setservent subroutine.

Sockets Overview in AIX Version 4.3 Communications Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]