TCP/IP Programming Manual

error = socket_get_info (rsock, (char*) &fhost, len);
if (error != 0)
{
printf ("socket_get_info failed, error %d\n", errno);
exit(1)
}
INET6: the following programming example calls the recvfrom_nw function. In this example,
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 <in6.h>
#include <netdb.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <cextdecs(AWAITIOX, FILE_GETINFO_)>
..
struct sockaddr_in6 fhost;
int len,rsock;
char buffer [8*1024];
short error, rsock2, rcount;
long tag;
..
error = recvfrom_nw(rsock, buffer, sizeof(buffer), 0,
(struct sockaddr *) &fhost, &len, tag);
if error (!= 0) /* some error checking */
{
printf ("recvfrom_nw failed, error %d\n," errno);
exit (1);
}
rsock2=(short)rsock; /* AWAITIOX/FILE_GETINFO_ expects a short
for socket descriptor */
(void) AWAITIOX (&rsock2,,&rcount,&tag,1l);
(void) FILE_GETINFO_ (rsock2, &error);
if (error != 0)
{
printf ("error from AWAITIOX, 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)
}
recvfrom_nw64_
The recvfrom_nw64_ function receives data on an unconnected UDP socket or raw socket created
for nowait operations.
C Synopsis
#include <socket.h>
#include <in.h>
#include <in6.h> /* for IPv6 use */
#include <netdb.h>
error = recvfrom_nw64_ (socket, buffer_ptr64, buffer_length,
flags, addr, r_buffer_length,
tag );
int error, socket;
164 Library Routines