TCP/IP Programming Manual
Errors
If an error occurs, the external variable errno is set to one of the following values:
The send buffer is already full.EALREADY
The message was too large to be sent atomically, as required by the socket options.EMSGSIZE
The specified socket was not connected.ENOTCONN
The specified socket was shut down.ESHUTDOWN
The connection timed out.ETIMEDOUT
The connection was reset by the remote host.ECONNRESET
An invalid flags value was specified.EINVAL
There is out-of-band data pending. This must be cleared with a call to recv_nw with the
MSG_OOB flag set.
EHAVEOOB
Usage Guidelines
• The operation initiated by send_nw must be completed with a call to the AWAITIOX or
AWAITIO procedure (although AWAITIOX is recommended).
• To determine the number of bytes that have been transferred as a result of the send_nw
function, check nb_sent (the first field of the send_nw_str structure). When the send_nw
function completes processing, AWAITIOX returns a pointer to nb_sent as its second
parameter and a count of 2 (the length of nb_sent) as its third parameter. This use of the
AWAITIOX parameters is nonstandard.
See Nowait Call Errors (page 86) for information on checking errors.
Example
The following programming example calls the send_nw routine and checks for the number of
bytes sent:
#include <socket.h>
#include <netdb.h>
...
struct send_nw_str *snw;
int cc, count = bp - &buf [0]; errno = 0;
...
for (bp = &buf [0]; count > 0; count -= cc) {
send_nw (socket, bp, count, 0, 0L);
AWAITIOX (&ret_fd, (char *)&snw, &cc, &ret_tag, -1L);
cc = snw->nb_sent;
if (cc < 0) break;
bp += cc;
};
Before the call to send_nw, the program creates a socket. The socket number is saved in the
variable socket. The pointer bp points to the data to be sent. The length of the buffer is count.
After the return from AWAITIOX, the program sets cc to the number of bytes in the nb_sent field
of the snw structure (based on the send_nw_str structure).
send_nw64_
The send_nw64_ function sends data on a connected socket. send_nw64_ is a nowait operation.
C Synopsis
#include <socket.h>
#include <netdb.h>
error = send_nw64_ (socket, nbuffer_ptr64, nbuffer_length, flags,
send_nw64_ 171