TCP/IP Programming Manual
Usage Guidelines
• This is a nowait call; it must be completed with a call to the FILE_AWAITIO64_ procedure.
For a waited call, use recvfrom64_.
• The parameters of the recvfrom_nw64_ function are not compatible with those of the
recvfrom64_ function in the 4.3 BSD UNIX operating system.
• The length of the received data is specified in the third parameter (count transferred) returned
from the FILE_AWAITIO64_ procedure. This length includes the address information given
by sizeof(sockaddr_in), sizeof (sockaddr_in6), or sizeof(sockaddr_nv)
at the beginning of the buffer.
• For IPv6 use, define the variable r_buffer_ptr64 as a pointer to a structure of type
sockaddr_in6.
For information on checking errors, see Nowait Call Errors (page 86).
Examples
INET: the following programming example calls the recvfrom_nw64_ function. rsock is a socket
created by a previous call to socket and fhost is a structure that receives the address of the
host from which the data is received. The data is received in buffer:
#include <socket.h>
#include <in.h>
#include <netdb.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <cextdecs.h>
..
struct sockaddr_in fhost;
int len,rsock, rcount;
char buffer [8*1024];
short error, rsock2;
long long tag;
..
error = recvfrom_nw64_(rsock, (char _ptr64*)&buffer, sizeof(buffer), 0,
(struct sockaddr *) &fhost, &len, tag);
if error (!= 0) /* some error checking */
{
printf ("recvfrom_nw64_ failed, error %d\n," errno);
exit (1);
}
rsock2=(short)rsock; /* AWAITIOX/FILE_GETINFO_ expects a short
for socket descriptor */
(void) FILE_AWAITIO64_ (&rsock2,,&rcount,&tag,1l);
(void) FILE_GETINFO_ (rsock2, &error);
if (error != 0)
{
printf ("error from FILE_GETINFO_, error %d\n", errno);
exit (1);
}
error = socket_get_info (rsock, (char*) &fhost, len);
if (error != 0)
{
printf ("socket_get_info failed, error %d\n", errno);
exit(1)
}
send
The send function sends data on a connected socket.
166 Library Routines