TCP/IP Programming Manual
Usage Guidelines
• Use send_nw2 on a socket created for nowait operations. The operation initiated by
send_nw2 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_nw2
function, call the socket_get_len call.
• For the send_nw2 call, complete the request with a call to AWIATIOX before issuing another
function call that uses nbuffer_ptr.
See Nowait Call Errors (page 86) for information on error checking.
Example
The following programming example calls the send_nw2 routine and checks for the number of
bytes sent:
#include <socket.h>
#include <netdb.h>
int s;
...
char *snw;
int cc, count = bp - &buf [0]; errno = 0;
...
for (bp = &buf [0]; count > 0; count -= cc) {
send_nw2 (socket, bp, count, 0, 0L);
AWAITIOX (&ret_fd, (char *)&snw, &cc, &ret_tag, -1L);
cc = socket_get_len(s);
if (cc < 0) break;
bp += cc;
};
Before the call to send_nw2, 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 sent by a call to the
socket_get_len function.
send_nw2_64_
The send_nw2_64_ function sends data on a connected socket. Unlike the send, send64_,
send_nw, and send_nw64_ calls, the send_nw2_64_ call does not store the number of bytes
sent, in the data buffer. Therefore, the send_nw2_64_ call does not require the application to
allocate 2 bytes in front of its data buffer to receive the number of bytes sent. Instead, the application
must call socket_get_len to obtain the number of bytes sent.
C Synopsis
#include <socket.h>
#include <netdb.h>
error := send_nw2_64_ (socket, nbuffer_ptr64, nbuffer_length,
flags, tag);
int error, socket;
char _ptr64 *nbuffer_ptr64;
int nbuffer_length, flags;
long long tag;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
send_nw2_64_ 175