ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/sendms.htm

860 lines
25 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>sendmsg()--Send a Message Over a Socket</title>
<!-- 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. -->
<!-- Begin Header Records ========================================== -->
<!-- Unix8 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- End Header Records -->
<!-- Edited by Kersten Feb 02 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>sendmsg()--Send a Message Over a Socket</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;BSD 4.3 Syntax<br>
<pre>
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
int sendmsg(int <em>socket_descriptor</em>,
struct msghdr *<em>message_structure</em>,
int <em>flags</em>)
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSOSRV1<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<br>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;<a href="_xopen_source.htm">UNIX 98 Compatible Syntax</a><br>
<pre>
#define _XOPEN_SOURCE 520
#include &lt;sys/socket.h&gt;
ssize_t sendmsg(int <em>socket_descriptor</em>,
const struct msghdr *<em>message_structure</em>,
int <em>flags</em>)
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSOSRV1<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <em>sendmsg()</em> function is used to send data or descriptors or
ancillary data or a combination of these through a connected or unconnected socket.</p>
<p>There are two versions of
the API, as shown above. The base i5/OS API uses BSD 4.3 structures and
syntax. The other uses syntax and structures compatible with the UNIX 98
programming interface specifications. You can select the UNIX 98 compatible
interface with the <a href="_xopen_source.htm">_XOPEN_SOURCE</a> macro.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>socket_descriptor</strong></dt>
<dd>(Input) The socket descriptor that is to be written to.<br>
<br>
</dd>
<dt><strong>message_structure</strong></dt>
<dd>(I/O) The pointer to the message structure that contains the following:
<ul>
<li>The address to which the message is to be sent<br>
<br>
</li>
<li>The vector array in which the data to be sent is stored<br>
<br>
</li>
<li>The ancillary data; or an access
rights list in which the descriptors to be sent are stored.</li>
</ul>
The structure pointed to by the <em>message_structure</em> parameter is defined
in <strong>&lt;sys/socket.h&gt;</strong>.
<p>The BSD 4.3 structure is:</p>
<pre>
struct msghdr {
caddr_t msg_name;
int msg_namelen;
struct iovec *msg_iov;
int msg_iovlen;
caddr_t msg_accrights;
int msg_accrightslen;
};
</pre>
<p>The BSD 4.4/UNIX 98 compatible structure is:</p>
<pre>
struct msghdr {
void *msg_name;
socklen_t msg_namelen;
struct iovec *msg_iov;
int msg_iovlen;
void *msg_control; /* Set to NULL if not needed */
socklen_t msg_controllen; /* Set to 0 if not needed */
int msg_flags;
};
</pre>
<p>The <em>msg_name</em> and <em>msg_namelen</em> fields contain the address
and address length to which the message is sent. For further information on the
structure of socket addresses, see
<a href="../rzab6/rzab6soxoverview.htm">Sockets Programming</a> in the iSeries
Information Center. If the <em>msg_name</em> field is set to a NULL pointer,
the address information is not returned.</p>
<p>The <em>msg_iov</em> and <em>msg_iovlen</em> fields are for scatter/gather
I/O.</p>
<p>The BSD 4.3 structure uses
the <em>msg_accrights</em> and <em>msg_accrightslen</em> fields to pass
descriptors. The <em>msg_accrights</em> field is a list of zero or more
descriptors, and <em>msg_accrightslen</em> is the total length (in bytes) of
the descriptor list.</p>
<p>The BSD 4.4/UNIX 98 compatible structure uses the <em>msg_control</em> and
<em>msg_controllen</em> fields to pass ancillary data. The <em>msg_control</em>
field is a pointer to ancillary data (of length <em>msg_controllen</em>) with
the form:</p>
<pre>
struct cmsghdr {
socklen_t cmsg_len; /* # bytes, including this header */
int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */
/* followed by unsigned char cmsg_data[]; */
};
</pre>
<p>The <em>cmsg_len</em> field is the total length including this header.
<em>cmsg_level</em> is the originating protocol. <em>cmsg_type</em> is the
protocol-specific type. If ancillary data is not being passed,
the <em>msg_control</em> field must be initalized to NULL and the
<em>msg_controllen</em> field must be initialized to 0.
The following tables list the supported ancillary data types when
using the BSD 4.4/UNIX 98 compatible structures.</p>
<p><strong><a name="Table_1-1">Ancillary Data Types That Apply to the Socket Layer
(where <em>cmsg_level</em> is <samp>SOL_SOCKET</samp> ):</a></strong></p>
<table border cellpadding="5">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top">cmsg_type</th>
<th align="left" valign="top">cmsg_data</th>
</tr>
<tr>
<td align="left" valign="top"><samp>SCM_RIGHTS</samp> </td>
<td align="left" valign="top">The rest of the buffer is a
list of zero or more descriptors to be sent.
<p>This ancillary data type is only supported for sockets with an
address family of AF_UNIX or AF_UNIX_CCSID.</p>
</td>
</tr>
</table>
<p><strong><a name="Table_1-2">Ancillary Data Types That Apply to the IP Layer
(where <em>cmsg_level</em> is <samp>IPPROTO_IP</samp>):</a></strong></p>
<table border cellpadding="5">
<!-- cols="25 75" -->
<tr>
<th align="left" valign="top">cmsg_type</th>
<th align="left" valign="top">cmsg_data</th>
</tr>
<tr>
<td align="left" valign="top"><samp>IP_QOS_CLASSIFICATION_DATA</samp> </td>
<td align="left" valign="top">The rest of the buffer is an
<em>ip_qos_classification_data</em> structure.
This structure is defined in <strong>&lt;netinet/ip.h&gt;</strong>.
For further information on the how this structure should be initialized,
see <a href="../rzak8/rzak8kickoff.htm">Quality of Service</a> in the
iSeries Information Center.
<p>This ancillary data type is only supported for sockets with an
address family of AF_INET and a type of SOCK_STREAM.</p>
</td>
</table>
<p>Macros are provided for navigating these structures.</p>
<ul>
<li><em><samp>CMSG_DATA(cmsg)</samp></em> If the argument is a pointer to a
<em>cmsghdr</em> structure, this macro returns an unsigned character pointer to
the data array associated with the <em>cmsghdr</em> structure.</li>
<li><em><samp>CMSG_NXTHDR(mhdr,cmsg)</samp></em> If the first argument is a
pointer to a <em>msghdr</em> structure and the second argument is a pointer to
a <em>cmsghdr</em> structure in the ancillary data, pointed to by the
msg_control field of that msghdr structure, this macro returns a pointer to the
next <em>cmsghdr</em> structure, or a null pointer if this structure is the
last <em>cmsghdr</em> in the ancillary data.</li>
<li><em><samp>CMSG_FIRSTHDR(mhdr)</samp></em> If the argument is a pointer to a
<em>msghdr</em> structure, this macro returns a pointer to the first
<em>cmsghdr</em> structure in the ancillary data associated with this
<em>msghdr</em> structure, or a null pointer if there is no ancillary data
associated with the <em>msghdr</em> structure.</li>
</ul>
<p>The BSD 4.4/UNIX 98 <em>msg_flags</em> field is ignored for sendmsg().</p>
</dd>
<dt><strong>flags</strong></dt>
<dd>(Input) A flag value that controls the transmission of the data. The
<em>flags</em> value is either zero, or is obtained by performing an OR
operation on one or more of the following constants:
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top"><em><samp>MSG_EOR</samp></em></td>
<td align="left" valign="top">Terminate a record, if supported by the
protocol.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em><samp>MSG_OOB</samp></em></td>
<td align="left" valign="top">Send data as out-of-band data. Valid only for
sockets with an address family of <samp>AF_INET</samp> or <samp>AF_INET6</samp>
and type <samp>SOCK_STREAM</samp>.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em><samp>MSG_DONTROUTE</samp></em></td>
<td align="left" valign="top">Bypass routing. Valid only for sockets with
address family of <samp>AF_INET</samp>. It is ignored for other address
families.</td>
</tr>
</table>
</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>When the address family of the socket identified by the
<strong><em>socket_descriptor</em></strong> is AF_INET and is running IP over
SNA, the thread must have retrieve, insert, delete, and update authority to the
APPC device. When the thread does not have this level of authority, an
<em>errno</em> of EACCES is returned.</p>
<br>
<h3>Return Value</h3>
<p><em>sendmsg()</em> returns an integer. Possible values are:</p>
<ul>
<li>-1 (unsuccessful)<br>
<br>
</li>
<li>n (successful), where n is the number of bytes sent.</li>
</ul>
<br>
<h3>Error Conditions</h3>
<p>When <em>sendmsg()</em> fails, <em>errno</em> can be set to one of the
following:</p>
<table cellpadding="5">
<!-- cols="20 80" -->
<tr>
<td align="left" valign="top"><em>[EACCES]</em></td>
<td align="left" valign="top">Permission denied.
<p>The process does not have the appropriate privileges to the destination
address.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EADDRNOTAVAIL]</em></td>
<td align="left" valign="top">Address not available.
<p>A socket with an address family of <samp>AF_INET</samp> or
<samp>AF_INET6</samp> is using a connectionless transport
service, the socket was not bound. The system tried to bind the socket but
could not because a port was not available.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EBADF]</em></td>
<td align="left" valign="top">Descriptor not valid.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ECONNREFUSED]</em></td>
<td align="left" valign="top">The destination socket refused an attempted
connect operation.
<p>This error code can only be returned on sockets that use a connectionless
transport service.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EDESTADDRREQ]</em></td>
<td align="left" valign="top">Operation requires destination address.
<p>A destination address has not been associated with the socket pointed to by
the <em>socket_descriptor</em> parameter and a destination address was not set
in the <em>msghdr</em> structure (pointed to by the <em>message_structure</em>
parameter). This error code can only be returned on sockets that use a
connectionless transport service.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EFAULT]</em></td>
<td align="left" valign="top">Bad address.
<p>The system detected an address which was not valid while attempting to
access the <em>message_structure</em> parameter or a field within the structure
pointed to by the <em>message_structure</em> parameter.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EHOSTDOWN]</em></td>
<td align="left" valign="top">A remote host is not available.
<p>This error code can only be returned on sockets that use a connectionless
transport service.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EHOSTUNREACH]</em></td>
<td align="left" valign="top">A route to the remote host is not available.
<p>This error code can only be returned on sockets that use a connectionless
transport service.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EINTR]</em></td>
<td align="left" valign="top">Interrupted function call.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EINVAL]</em></td>
<td align="left" valign="top">Parameter not valid.
<p>This error code indicates one of the following:</p>
<ul>
<li>The <em>msg_iovlen</em> field or the <strong>iov_len</strong> field in a
<strong>iovec</strong> structure specifies a negative value. The fields are
contained in the <em>msghdr</em> structure (pointed to by the
<em>message_structure</em> parameter).<br>
<br>
</li>
<li>The <em>msg_namelen</em> field in the <em>msghdr</em> structure (pointed to
by the <em>message_structure</em> parameter) specifies a length that is not
valid for the address family.<br>
<br>
</li>
<li>The <em>msg_accrightslen</em> field in the <em>msghdr</em> structure
specifies a negative value or is not large enough when <em>msg_accrights</em>
was specified. <br>
<br>
</li>
<li>The <em>msg_controllen</em> field in the <em>msghdr</em> structure
specifies a negative value or is not large enough when <em>msg_control</em>
was specified. <br>
<br>
</li>
<li>The <em>socket_descriptor</em> points to a socket with an address family of
<samp>AF_UNIX_CCSID</samp>, and the CCSID specified in <em>sunc_qlg</em> in the
<strong>sockaddr_unc</strong> structure (pointed to by <em>local_address</em>)
cannot be converted to the current default CCSID for integrated file system
path names.<br>
<br>
</li>
<li>The <em>socket_descriptor</em> points to a socket with an address family of
<samp>AF_UNIX_CCSID</samp>, and there was an incomplete character or shift
state sequence at the end of <em>sunc_path</em> in the
<strong>sockaddr_unc</strong> structure (pointed to by
<em>local_address</em>).<br>
<br>
</li>
<li>The <em>socket_descriptor</em> points to a socket with an address family of
<samp>AF_UNIX_CCSID</samp>, and the <strong>sockaddr_unc</strong> structure
(pointed to by <em>local_address</em>) was not valid:
<ul>
<li>The sunc_format was not set to SO_UNC_DEFAULT or SO_UNC_USE_QLG.<br>
<br>
</li>
<li>The sunc_zero was not initialized to zeros.<br>
<br>
</li>
<li>The sunc_format field was set to SO_UNC_USE_QLG and the sunc_qlg structure
was not valid:
<ul>
<li>The path type was less than 0 or greater than 3.<br>
<br>
</li>
<li>The path length was less than 0 or out of bounds. For example, a
single-byte path name was greater than 126 bytes or a double-byte path name was
greater than 252 bytes.<br>
<br>
</li>
<li>A reserved field was not initialized to zeros.</li>
</ul>
</li>
</ul>
</li>
</ul>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EIO]</em></td>
<td align="left" valign="top">Input/output error.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EISCONN]</em></td>
<td align="left" valign="top">A connection has already been established.
<p>A destination address was set, but the socket pointed to by the
<em>socket_descriptor</em> parameter already has a destination address
associated with it.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ELOOP]</em></td>
<td align="left" valign="top">A loop exists in symbolic links encountered
during pathname resolution.
<p>This error code refers to the destination address, and can only be returned
by sockets that use the <samp>AF_UNIX</samp> or <samp>AF_UNIX_CCSID</samp>
address family.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EMSGSIZE]</em></td>
<td align="left" valign="top">Message size out of range.
<p>This error code indicates one of the following:</p>
<ul>
<li>The data to be sent could not be sent atomically because the total size of
the data to be sent is too large.<br>
<br>
</li>
<li>The <em>msg_iovlen</em> field in the <em>msghdr</em> structure (pointed to
by the <em>message_structure</em> parameter) specifies a value that is greater
than [MSG_MAXIOVLEN] (defined in <strong>&lt;sys/socket.h&gt;</strong>).</li>
</ul>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENAMETOOLONG]</em></td>
<td align="left" valign="top">File name too long.
<p>This error code refers to the destination address, and can only be returned
by sockets that use the <samp>AF_UNIX</samp> or <samp>AF_UNIX_CCSID</samp>
address family.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENETDOWN]</em></td>
<td align="left" valign="top">The network is not currently available.
<p>This error code can only be returned on sockets that use a connectionless
transport service.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENETUNREACH]</em></td>
<td align="left" valign="top">Cannot reach the destination network.
<p>This error code can only be returned on sockets that use a connectionless
transport service.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENOBUFS]</em></td>
<td align="left" valign="top">There is not enough buffer space for the
requested operation.</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENOENT]</em></td>
<td align="left" valign="top">No such file or directory.
<p>This error code refers to the destination address, and can only be returned
by sockets that use the <samp>AF_UNIX</samp> or <samp>AF_UNIX_CCSID</samp>
address family.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENOSYS]</em></td>
<td align="left" valign="top">Function not implemented.
<p>This error code refers to the destination address, and can only be returned
by sockets that use the <samp>AF_UNIX</samp> or <samp>AF_UNIX_CCSID</samp>
address family.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENOTCONN]</em></td>
<td align="left" valign="top">Requested operation requires a connection.
<p>This error code can only be returned on sockets that use a
connection-oriented transport service.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENOTDIR]</em></td>
<td align="left" valign="top">Not a directory.
<p>This error code refers to the destination address, and can only be returned
by sockets that use the <samp>AF_UNIX</samp> or <samp>AF_UNIX_CCSID</samp>
address family.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ENOTSOCK]</em></td>
<td align="left" valign="top">The specified descriptor does not reference a
socket.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EOPNOTSUPP]</em></td>
<td align="left" valign="top">Operation not supported.
<p>This error code indicates one of the following:</p>
<ul>
<li>The <em>flags</em> parameter specifies a value that includes the
<samp>MSG_OOB</samp> flag, but the <em>socket_descriptor</em> parameter points
to a connectionless socket.<br>
<br>
</li>
<li>The <em>flags</em> parameter specifies a value that includes the
<samp>MSG_OOB</samp> flag, but the <em>socket_descriptor</em> parameter points
to a socket that does not have an address family of <samp>AF_INET</samp> or
<samp>AF_INET6</samp>.<br>
<br>
</li>
<li>The <em>msg_accrights</em> and <em>msg_accrightslen</em> (or the
BSD 4.4/UNIX 98 compatible fields <em>msg_control</em> and
<em>msg_controllen</em>) were specified and the underlying
instance represented by the descriptor does not support the passing of access
rights.</li>
</ul>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EPIPE]</em></td>
<td align="left" valign="top">Broken pipe.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EUNATCH]</em></td>
<td align="left" valign="top">The protocol required to support the specified
address family is not available at this time.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EUNKNOWN]</em></td>
<td align="left" valign="top">Unknown system state.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EWOULDBLOCK]</em></td>
<td align="left" valign="top">Operation would have caused the thread to be
suspended.</td>
</tr>
</table>
<br>
<br>
<h3>Error Messages</h3>
<table width="100%" cellpadding="5">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td width="15%" valign="top">CPE3418 E</td>
<td width="85%" valign="top">Possible APAR condition or hardware failure.</td>
</tr>
<tr>
<td align="left" valign="top">CPF9872 E</td>
<td align="left" valign="top">Program or service program &amp;1 in library
&amp;2 ended. Reason code &amp;3.</td>
</tr>
<tr>
<td align="left" valign="top">CPFA081 E</td>
<td align="left" valign="top">Unable to set return value or error code.</td>
</tr>
</table>
<br>
<br>
<h3>Usage Notes</h3>
<ol>
<li>The passing of descriptors is only supported over sockets that have an
address family of <samp>AF_UNIX</samp> or <samp>AF_UNIX_CCSID</samp>. The
<em>msg_accrightslen</em> and the <em>msg_accrights</em> fields (or the
BSD 4.4/UNIX 98 compatible fields <em>msg_control</em> and
<em>msg_controllen</em>) are ignored if the socket has any other
address family. When you use <em>sendmsg()</em> and <em>recvmsg()</em> to pass
descriptors, the target job must be running with either of the following:
<ul>
<li>The same user profile as the source job (in essence, passing the descriptor
to yourself)</li>
<li>*ALLOBJ special authority</li>
</ul>
If the target job closes the receiving end of the UNIX domain socket while a
descriptor is in transit, the descriptor is reclaimed by the system, and the
resource that it represented is closed. For files and directories, the ability
to pass descriptors using <em>sendmsg()</em> and <em>recvmsg()</em> is only
supported for objects in
Root, QOpenSys, User-defined file systems (UDFS), and Network File System (NFS).
<br>
<br>
</li>
<li><em>sendmsg()</em> is an atomic operation in that it produces one packet of
data each time the call is issued on a connectionless socket. For example, a
<em>sendmsg()</em> to a datagram socket will result in a single datagram.<br>
<br>
</li>
<li>A destination address cannot be specified if the socket pointed to by the
<em>socket_descriptor</em> parameter already has a destination address
associated with it. To <strong>not</strong> specify an address, users must set
the <em>msg_name</em> field to NULL or set the <em>msg_namelen</em> field to
zero. (Not specifying an address by setting the <em>msg_namelen</em> field to
zero is an IBM extension.)
<p><strong>Note:</strong> The <em>msg_name</em> and <em>msg_namelen</em> fields
are ignored if the socket is using a connection-oriented transport service.</p>
</li>
<li>If the socket is using a connectionless transport device, the socket is not
bound to an address, and the socket type is <samp>SOCK_DGRAM</samp>, the system
automatically selects an address (INADDR_ANY or in6addr_any and an available
port number) and binds it to the socket before sending the data.<br>
<br>
</li>
<li>To broadcast on an <samp>AF_INET</samp> socket, the socket option
<samp>SO_BROADCAST</samp> must be set (with a <em>setsockopt()</em>).<br>
<br>
</li>
<li>When using a connection-oriented transport service, all errors except
<samp>[EUNATCH]</samp> and <samp>[EUNKNOWN]</samp> are mapped to
<samp>[EPIPE]</samp> on an output operation when either of the following
occurs:
<ul>
<li>A connection that is in progress is unsuccessful.<br>
<br>
</li>
<li>An established connection is broken.</li>
</ul>
To get the actual error, use <em>getsockopt()</em> with the
<samp>SO_ERROR</samp> option, or perform an input operation (for example,
<em>read()</em>).<br>
<br>
</li>
<li>If the socket is using an address family of <samp>AF_UNIX</samp>, the
destination address (which is a path name) is assumed to be in the default
coded character set identifier (CCSID) currently in effect for the job. For
<samp>AF_UNIX_CCSID</samp>, the destination address is assumed to be in the
format and coded character set identifier (CCSID) specified in the
<strong>sockaddr_unc</strong>.<br>
<br>
</li>
<li>For <samp>AF_INET</samp> sockets over SNA, type <samp>SOCK_DGRAM</samp>, if
a datagram can not be delivered, no errors are returned. (As an example, a
datagram might not be delivered if there is no datagram application at the
remote host listening at the requested port.)</li>
<li>When you develop in C-based
languages and an application is compiled with the _XOPEN_SOURCE macro defined
to the value 520 or greater, the <em>sendmsg()</em> API is mapped to
<em>qso_sendmsg98()</em>.</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li>For additional information and sample programs on how to use sendmsg() and
recvmsg() to pass descriptors between iSeries jobs, see <a href=
"../rzab6/rzab6soxoverview.htm">Socket Programming</a> in the iSeries
Information Center.<br>
<br>
</li>
<li><a href="_xopen_source.htm">_XOPEN_SOURCE</a>--Using _XOPEN_SOURCE for the
UNIX 98 compatible interface<br>
<br>
</li>
<li><a href="fcntl.htm">fcntl()</a>--Perform File Control Command<br>
<br>
</li>
<li><a href="ioctl.htm">ioctl()</a>--Perform I/O Control Request<br>
<br>
</li>
<li><a href="gvsoc.htm">givedescriptor()</a>--Pass Descriptor Access to Another
Job<br>
<br>
</li>
<li><a href="send.htm">send()</a>--Send Data<br>
<br>
</li>
<li><a href="sendto.htm">sendto()</a>--Send Data<br>
<br>
</li>
<li><a href="tksoc.htm">takedescriptor()</a>--Receive Socket Access from Another
Job</li>
</ul>
<br>
<hr>
API introduced: V3R1
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> |
<a href="unix.htm">UNIX-Type APIs</a> |
<a href="aplist.htm">APIs by category</a> </td>
</tr>
</table>
</center>
</body>
</html>