
Chapter 3 Terminal Specific Function Library
163
Byte Swapping
htonl
Purpose
To convert an unsigned long integer from host byte order to network byte
order.
Syntax
unsigned long htonl (unsigned long val);
unsigned long val; /* an unsigned long integer to be converted */
Example
(?)
Description
This routine converts an unsigned long integer from host byte order to network
byte order.
Return
If successful, it returns the value of conversion.
Otherwise (?)
See Also
ntohl
htons
Purpose
To convert an unsigned (short) integer from host byte order to network byte
order.
Syntax
unsigned htons (unsigned val);
unsigned val; /* an unsigned integer to be converted */
Example
struct sockaddr_in name;
s = socket (PF_INET, SOCK_STREAM, TCP);
if (s < 0) {
printf ("SOCKET allocation failed");
.......................
}
memset (&name, 0, sizeof (name));
name.sin_family = AF_INET;
name.sin_port = htons (3000);
Description
This routine converts an unsigned (short) integer from host byte order to
network byte order.
Return
If successful, it returns the value of conversion.
Otherwise (?)
See Also
ntohs
Summary of Contents for Optimus R
Page 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Page 6: ......
Page 8: ...2 C Programming Guide For Optimus S R...
Page 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Page 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Page 24: ...18 C Programming Guide For Optimus S R...
Page 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...