ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzab6_5.4.0.1/cafinet.htm

113 lines
5.7 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="AF_INET address family" />
<meta name="abstract" content="This address family provides interprocess communications between processes that run on the same system or on different systems." />
<meta name="description" content="This address family provides interprocess communications between processes that run on the same system or on different systems." />
<meta name="DC.Relation" scheme="URI" content="address.htm" />
<meta name="DC.Relation" scheme="URI" content="uafinet.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2001, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="cafinet" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>AF_INET address family</title>
</head>
<body id="cafinet"><a name="cafinet"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">AF_INET address family</h1>
<div><p>This address family provides interprocess communications between
processes that run on the same system or on different systems.</p>
<div class="section"><p>Addresses for AF_INET sockets are IP addresses and port number.
You can specify an IP address for an AF_INET socket either as an IP address,
such as 130.99.128.1, or in its 32bit form, X'82638001'. </p>
</div>
<div class="section"><p>For a socket application that uses the Internet Protocol version
4 (IPv4), the AF_INET address family uses the <span class="apiname">sockaddr_in</span> address
structure. When you use _XOPEN_SOURCE macro, the AF_INET address structure
changes to be compatible with BSD 4.4/ UNIX<sup>®</sup> 98 specifications. For the sockaddr_in
address structure, these differences are summarized in the table:</p>
</div>
<div class="section"><div class="p">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. Differences between BSD 4.3 and BSD 4.4/ UNIX 98 for sockaddr_in
address structure</caption><thead align="left"><tr><th valign="top" id="d0e41">BSD 4.3 sockaddr_in address structure</th>
<th valign="top" id="d0e43">BSD 4.4/ UNIX 98 sockaddr_in address structure</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e41 "> <pre>struct sockaddr_in {
short sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};</pre>
</td>
<td valign="top" headers="d0e43 "> <pre>struct sockaddr_in {
uint8_t sin_len;
sa_family_t sin_family;
u_short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section"><div class="p">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 2. AF_INET address structure </caption><thead align="left"><tr><th valign="top" id="d0e69">Address structure field</th>
<th valign="top" id="d0e71">Definition</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e69 ">sin_len</td>
<td valign="top" headers="d0e71 ">This field contains the length of the address for UNIX 98
specifications. <div class="note"><span class="notetitle">Note:</span> The sin_len field is only provided for
BSD 4.4 compatibility. It is not necessary to use this field even when using
BSD 4.4/ UNIX 98
compatibility. The field is ignored on input addresses.</div>
</td>
</tr>
<tr><td valign="top" headers="d0e69 ">sin_family</td>
<td valign="top" headers="d0e71 ">This field contains the address family, which is always
AF_INET when TCP or User Datagram Protocol (UDP) is used.</td>
</tr>
<tr><td valign="top" headers="d0e69 ">sin_port</td>
<td valign="top" headers="d0e71 ">This field contains the port number.</td>
</tr>
<tr><td valign="top" headers="d0e69 ">sin_addr</td>
<td valign="top" headers="d0e71 ">This field contains the IP address.</td>
</tr>
<tr><td valign="top" headers="d0e69 ">sin_zero</td>
<td valign="top" headers="d0e71 ">This field is reserved. Set this field to hexadecimal
zeros.</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="address.htm" title="The address family parameter on a socket() determines the format of the address structure to use on socket functions.">Socket address family</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="uafinet.htm" title="AF_INET address family sockets can be either connection-oriented (type SOCK_STREAM) or they can be connectionless (type SOCK_DGRAM).">Use AF_INET address family</a></div>
</div>
</div>
</body>
</html>