112 lines
7.1 KiB
HTML
112 lines
7.1 KiB
HTML
<?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="Out-of-band data" />
|
|
<meta name="abstract" content="Out-of-band (OOB) data is user-specific data that only has meaning for connection-oriented (stream) sockets." />
|
|
<meta name="description" content="Out-of-band (OOB) data is user-specific data that only has meaning for connection-oriented (stream) sockets." />
|
|
<meta name="DC.Relation" scheme="URI" content="aconcepts.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="csignals.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../apis/sendms.htm" />
|
|
<meta name="DC.Relation" scheme="URI" content="../cl/chgtcpa.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="coobd" />
|
|
<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>Out-of-band data</title>
|
|
</head>
|
|
<body id="coobd"><a name="coobd"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Out-of-band data</h1>
|
|
<div><p>Out-of-band (OOB) data is user-specific data that only has meaning
|
|
for connection-oriented (stream) sockets. </p>
|
|
<p>Stream data is generally received in the same order it is sent. OOB data
|
|
is received independent of its position in the stream (independent of the
|
|
order in which it was sent). This is possible because the data is marked in
|
|
such a way that, when it is sent from program A to program B, program B is
|
|
notified of its arrival.</p>
|
|
<p>OOB data is supported on AF_INET (SOCK_STREAM) and AF_INET6 (SOCK_STREAM)
|
|
only.</p>
|
|
<p>OOB data is sent by specifying the MSG_OOB flag on the <span class="apiname">send()</span>, <span class="apiname">sendto()</span>,
|
|
and <span class="apiname">sendmsg()</span> functions.</p>
|
|
<p>The transmission of OOB data is the same as the transmission of regular
|
|
data. It is sent after any data that is buffered. In other words, OOB data
|
|
does not take precedence over any data that may be buffered; data is transmitted
|
|
in the order that it was sent.</p>
|
|
<p>On the receiving side, things are a little more complex:</p>
|
|
<ul><li>The sockets API keeps track of OOB data that is received on a system by
|
|
using an OOB marker. The OOB marker points to the last byte in the OOB data
|
|
that was sent. <div class="note"><span class="notetitle">Note:</span> The value that indicates which byte the OOB marker points
|
|
to is set on a system basis (all applications use that value). This value
|
|
must be consistent between the local and remote ends of a TCP connection.
|
|
Socket applications that use this value must use it consistently between
|
|
the client and server applications. </div>
|
|
<p>The <span class="apiname">SIOCATMARK ioctl()</span> request determines if the read
|
|
pointer is pointing to the last OOB byte.</p>
|
|
<div class="note"><span class="notetitle">Note:</span> If multiple occurrences
|
|
of OOB data are sent, the OOB marker points to the last OOB byte of the final
|
|
OOB data occurrence.</div>
|
|
</li>
|
|
<li>Independent of whether OOB data is received inline, an
|
|
input operation processes data up to the OOB marker, if OOB data was sent.</li>
|
|
<li>A <span class="apiname">recv()</span>, <span class="apiname">recvmsg()</span>,
|
|
or <span class="apiname">recvfrom()</span> function (with the MSG_OOB flag set) is used
|
|
to receive OOB data. An error of [EINVAL] is returned if one of the receive
|
|
functions has been completed and one of the following situations occurs: <ul><li>The socket option SO_OOBINLINE is not set and there is no OOB data to
|
|
receive.</li>
|
|
<li>The socket option SO_OOBINLINE is set.</li>
|
|
</ul>
|
|
<p>If the socket option SO_OOBINLINE is not set, and the sending program
|
|
sent OOB data with a size greater than one byte, all the bytes
|
|
but the last are considered normal data. (Normal data means that the receiving
|
|
program can receive data without specifying the MSG_OOB flag.) The last byte
|
|
of the OOB data that was sent is not stored in the normal data stream. This
|
|
byte can only be retrieved by issuing a<span class="apiname"> recv()</span>, <span class="apiname">recvmsg()</span>,
|
|
or <span class="apiname">recvfrom()</span> function with the MSG_OOB flag set. If a
|
|
receive operation is issued with the MSG_OOB flag not set, and normal data
|
|
is received, the OOB byte is deleted. Also, if multiple occurrences of OOB
|
|
data are sent, the OOB data from the preceding occurrence is lost, and the
|
|
position of the OOB data of the final OOB data occurrence is remembered.</p>
|
|
<p>If
|
|
the socket option SO_OOBINLINE is set, then all of the OOB data that was sent
|
|
is stored in the normal data stream. Data can be retrieved by issuing one
|
|
of the three receive functions without specifying the MSG_OOB flag (if it
|
|
is specified, an error of [EINVAL] is returned). OOB data is not lost if multiple
|
|
occurrences of OOB data are sent.</p>
|
|
</li>
|
|
<li>OOB data is not discarded if SO_OOBINLINE is not set, OOB data has been
|
|
received, and the user then sets SO_OOBINLINE on. The initial OOB byte is
|
|
considered normal data.</li>
|
|
<li>If SO_OOBINLINE is not set, OOB data was sent, and the receiving program
|
|
issued an input function to receive the OOB data, then the OOB marker is still
|
|
valid. The receiving program can still check if the read pointer is at the
|
|
OOB marker, even though the OOB byte was received.</li>
|
|
</ul>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="aconcepts.htm" title="Advanced socket concepts go beyond a general discussion of what sockets are and how they work. They provide ways to design socket applications for larger and more complex networks.">Advanced socket concepts</a></div>
|
|
</div>
|
|
<div class="relconcepts"><strong>Related concepts</strong><br />
|
|
<div><a href="csignals.htm" title="An application program can request to be notified asynchronously (request that the system send a signal) when a condition that the application is interested in occurs.">Signals</a></div>
|
|
</div>
|
|
<div class="relinfo"><strong>Related information</strong><br />
|
|
<div><a href="../apis/sendms.htm">sendmsg()</a></div>
|
|
<div><a href="../cl/chgtcpa.htm">Change TCP Attributes (CHGTCPA) command</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |