delorie.com/djgpp/doc/libc/libc_465.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

htons

Syntax

 
#include <netinet/in.h>

unsigned short htons(unsigned short val);

Description

This function converts from host formatted shorts to network formatted shorts. For the i386 and higher processors, this means that the bytes are swapped from 12 order to 21 order.

Return Value

The network-order value.

Portability

ANSI/ISO C No
POSIX No

Example

 
tcp.port = htons(port);


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004