BYTEORDER(3) Library Functions Manual BYTEORDER(3)

htonl, htons, ntohl, ntohs - muda a ordem dos bytes para a ordem do 'host' ou a da rede

Biblioteca C Padrão (libc, -lc)

#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);

The htonl() function converts the unsigned integer hostlong from host byte order to network byte order.

The htons() function converts the unsigned short integer hostshort from host byte order to network byte order.

The ntohl() function converts the unsigned integer netlong from network byte order to host byte order.

The ntohs() function converts the unsigned short integer netshort from network byte order to host byte order.

A ordem de bytes na arquitetura i386 começa com o byte menos significativo, e, na rede (por exemplo na internet), o byte mais significativo vem primeiro.

Para uma explicação dos termos usados nesta seção, consulte attributes(7).

Interface Atributo Valor
htonl(), htons(), ntohl(), ntohs() Thread safety MT-Safe

POSIX.1-2008.

POSIX.1-2001.

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

A tradução para português brasileiro desta página man foi criada por Paulo César Mendes <drpc@ism.com.br> e André Luiz Fassone <lonely_wolf@ig.com.br>

Esta tradução é uma documentação livre; leia a Licença Pública Geral GNU Versão 3 ou posterior para as condições de direitos autorais. Nenhuma responsabilidade é aceita.

Se você encontrar algum erro na tradução desta página de manual, envie um e-mail para a lista de discussão de tradutores.

20 julho 2023 Linux man-pages 6.05.01