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

172 lines
9.5 KiB
HTML
Raw Permalink 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="concept" />
<meta name="DC.Title" content="Socket characteristics" />
<meta name="abstract" content="Sockets share some common characteristics." />
<meta name="description" content="Sockets share some common characteristics." />
<meta name="DC.Relation" scheme="URI" content="rzab6soxoverview.htm" />
<meta name="DC.Relation" scheme="URI" content="socaddr.htm" />
<meta name="DC.Relation" scheme="URI" content="address.htm" />
<meta name="DC.Relation" scheme="URI" content="type.htm" />
<meta name="DC.Relation" scheme="URI" content="protocols.htm" />
<meta name="DC.Relation" scheme="URI" content="routines.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/unix8.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="characteristics" />
<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>Socket characteristics</title>
</head>
<body id="characteristics"><a name="characteristics"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Socket characteristics</h1>
<div><p>Sockets share some common characteristics.</p>
<ul><li>A socket is represented by an integer. That integer is called a <dfn class="term">socket
descriptor</dfn>. </li>
<li>A socket exists as long as the process maintains an open link to the socket.</li>
<li>You can name a socket and use it to communicate with other sockets in
a communication domain.</li>
<li>Sockets perform the communication when the server accepts connections
from them, or when it exchanges messages with them.</li>
<li>You can create sockets in pairs (only for sockets in the AF_UNIX address
family).</li>
</ul>
<p>The connection that a socket provides can be connection-oriented or connectionless. <dfn class="term">Connection-oriented</dfn> communication
implies that a connection is established, and a dialog between the programs
follows. The program that provides the service (the server program) establishes
the available socket that is enabled to accept incoming connection requests.
Optionally, the server can assign a name to the service that it supplies
which allows clients to identify where to obtain and how to connect to that
service. The client of the service (the client program) must request the service
of the server program. The client does this by connecting to the distinct
name or to the attributes associated with the distinct name that the server
program has designated. It is similar to dialing a telephone number (an identifier)
and making a connection with another party that is offering a service (for
example, a plumber). When the receiver of the call (the server, in this example,
a plumber) answers the telephone, the connection is established. The plumber
verifies that you have reached the correct party, and the connection remains
active as long as both parties require it.</p>
<p><em>Connectionless</em> communication implies that no connection is established
over which a dialog or data transfer can take place. Instead, the server program
designates a name that identifies where to reach it (much like a post office
box). If you send a letter to a post office box, you cannot be absolutely
sure the receiver got the letter. You might need to wait for a response to
your letter. There is no active, real-time connection in which data is exchanged.</p>
<div class="section"><h4 class="sectiontitle">How socket characteristics are determined</h4><p>When an
application creates a socket with the <span class="apiname">socket()</span> function,
it must identify the socket by specifying these parameters:</p>
<div class="p"> <ul><li>The socket address family determines the format of the
address structure for the socket. This topic contains examples of each address
family's address structure.</li>
<li>The socket type determines the form of communication for
the socket.</li>
<li>The socket protocol determines the supported protocols
that the socket uses.</li>
</ul>
</div>
<p>These parameters or characteristics define the socket application
and how it interoperates with other socket applications. Depending on the
address family of a socket, you have different choices for the socket type
and protocol. The following table shows the corresponding address
family and its associated socket type and protocols:</p>
<div class="p">
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption>Table 1. Summary of socket characteristics</caption><thead align="left"><tr><th valign="top" id="d0e68">Address family</th>
<th valign="top" id="d0e70">Socket type</th>
<th valign="top" id="d0e72">Socket protocol</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e68 ">AF_UNIX</td>
<td valign="top" headers="d0e70 ">SOCK_STREAM</td>
<td valign="top" headers="d0e72 ">N/A</td>
</tr>
<tr><td valign="top" headers="d0e68 ">&nbsp;</td>
<td valign="top" headers="d0e70 ">SOCK_DGRAM</td>
<td valign="top" headers="d0e72 ">N/A</td>
</tr>
<tr><td valign="top" headers="d0e68 ">AF_INET</td>
<td valign="top" headers="d0e70 ">SOCK_STREAM</td>
<td valign="top" headers="d0e72 ">TCP</td>
</tr>
<tr><td valign="top" headers="d0e68 ">&nbsp;</td>
<td valign="top" headers="d0e70 ">SOCK_DGRAM</td>
<td valign="top" headers="d0e72 ">UDP</td>
</tr>
<tr><td valign="top" headers="d0e68 ">&nbsp;</td>
<td valign="top" headers="d0e70 ">SOCK_RAW</td>
<td valign="top" headers="d0e72 ">IP, ICMP</td>
</tr>
<tr><td valign="top" headers="d0e68 ">AF_INET6</td>
<td valign="top" headers="d0e70 ">SOCK_STREAM </td>
<td valign="top" headers="d0e72 ">TCP</td>
</tr>
<tr><td valign="top" headers="d0e68 ">&nbsp;</td>
<td valign="top" headers="d0e70 ">SOCK_DGRAM </td>
<td valign="top" headers="d0e72 ">UDP</td>
</tr>
<tr><td valign="top" headers="d0e68 ">&nbsp;</td>
<td valign="top" headers="d0e70 ">SOCK_RAW</td>
<td valign="top" headers="d0e72 ">IP6, ICMP6</td>
</tr>
<tr><td valign="top" headers="d0e68 ">AF_UNIX_CCSID</td>
<td valign="top" headers="d0e70 ">SOCK_STREAM </td>
<td valign="top" headers="d0e72 ">N/A</td>
</tr>
<tr><td valign="top" headers="d0e68 ">&nbsp;</td>
<td valign="top" headers="d0e70 ">SOCK_DGRAM</td>
<td valign="top" headers="d0e72 ">N/A</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>In addition to these socket characteristics or parameters,
constant values are defined in network routines and header files that are
shipped with the QSYSINC library. For descriptions of header files, see the
individual APIs. Each API lists its appropriate header file in the usage section
of the API description.</p>
<p>Socket network routines allow
socket applications to obtain information from the Domain Name System (DNS),
host, protocol, service, and network files. </p>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="socaddr.htm">Socket address structure</a></strong><br />
Sockets use the <strong>sockaddr</strong> address structure to pass and to
receive addresses. This structure does not require the socket API to recognize
the addressing format.</li>
<li class="ulchildlink"><strong><a href="address.htm">Socket address family</a></strong><br />
The address family parameter on a <span class="apiname">socket()</span> determines
the format of the address structure to use on socket functions.</li>
<li class="ulchildlink"><strong><a href="type.htm">Socket type</a></strong><br />
The second parameter on a socket call determines the type of socket. Socket type provides identification of the type and characteristics of the connection that are enabled for transportation of the data from one machine to another or from one process to another.</li>
<li class="ulchildlink"><strong><a href="protocols.htm">Socket protocols</a></strong><br />
Protocols provide the network transportation of an application's data from one machine to another (or from one process to another within the same machine).</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzab6soxoverview.htm" title="A socket is a communications connection point (endpoint) that you can name and address in a network.">Socket programming</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="routines.htm" title="Socket network functions allow application programs to obtain information from the host, protocol, service, and network files.">Socket network functions</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../apis/unix8.htm">Socket APIs</a></div>
</div>
</div>
</body>
</html>