119 lines
3.9 KiB
HTML
119 lines
3.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>htonl</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
|
|
<basefont size="3"> <a name="htonl"></a> <a name="tag_03_265"></a><!-- htonl -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_265_01"></a>NAME</h4>
|
|
|
|
<blockquote>htonl, htons, ntohl, ntohs - convert values between host and network byte order</blockquote>
|
|
|
|
<h4><a name="tag_03_265_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>#include <<a href="../basedefs/arpa/inet.h.html">arpa/inet.h</a>><br>
|
|
<br>
|
|
uint32_t htonl(uint32_t</tt> <i>hostlong</i><tt>);<br>
|
|
uint16_t htons(uint16_t</tt> <i>hostshort</i><tt>);<br>
|
|
uint32_t ntohl(uint32_t</tt> <i>netlong</i><tt>);<br>
|
|
uint16_t ntohs(uint16_t</tt> <i>netshort</i><tt>);<br>
|
|
</tt></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>These functions shall convert 16-bit and 32-bit quantities between network byte order and host byte order.</p>
|
|
|
|
<p>On some implementations, these functions are defined as macros.</p>
|
|
|
|
<p>The <b>uint32_t</b> and <b>uint16_t</b> types are defined in <a href=
|
|
"../basedefs/inttypes.h.html"><i><inttypes.h></i></a>.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>htonl</i>() and <i>htons</i>() functions shall return the argument value converted from host to network byte order.</p>
|
|
|
|
<p>The <i>ntohl</i>() and <i>ntohs</i>() functions shall return the argument value converted from network to host byte order.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>No errors are defined.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_265_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>These functions are most often used in conjunction with IPv4 addresses and ports as returned by <a href=
|
|
"../functions/gethostent.html"><i>gethostent</i>()</a> and <a href="../functions/getservent.html"><i>getservent</i>()</a>.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="endhostent.html"><i>endhostent</i>()</a> , <a href="endservent.html"><i>endservent</i>()</a> , the Base Definitions
|
|
volume of IEEE Std 1003.1-2001, <a href="../basedefs/inttypes.h.html"><i><inttypes.h></i></a>, <a href=
|
|
"../basedefs/arpa/inet.h.html"><i><arpa/inet.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_265_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 6. Derived from the XNS, Issue 5.2 specification.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|