TCP/IP Programming Manual
 total_received := 0;
 DO BEGIN
 nrcvd := 0;
 IF ((nrcvd := recv( sock
 ,buf[total_received]
 ,$OCCURS(buf)-total_received
 ,0)) < 0)
 THEN BEGIN
 PRINT_ERROR(recv_error);
 CALL CRE_TERMINATOR_(CRE^Completion^fatal);
 END;
 IF (nrcvd = 0)
 THEN BEGIN
 term_msg(con_close);
 CALL CRE_TERMINATOR_(CRE^Completion^warning);
 END;
 total_received := total_received + nrcvd;
 END UNTIL total_received >= bytes_from_term;
 buf[total_received] := 0; -- Null Termination.
 CALL term_msg(buf);
 END;
 CALL FILE_CLOSE_(sock);
 CALL CRE_TERMINATOR_(CRE^Completion^normal);
END;
Using AF_INET6 Sockets
This section contains a client and server program that use AF_INET6 sockets.
AF_INET6 Client Stub Routine
This example shows a sample client program that you can build, compile, and run on your system.
The program sends a request to and receives a response from the system specified on the command
line. All addresses are in IPv6 address format.
/*
 * AF_INET6 Client Stub Routine
 * *****************************************************************
 * * *
 * * Copyright (c) Hewlett-Packard Company, 2003 *
 * * *
 * * The software contained on this media is proprietary to *
 * * and embodies the confidential technology of Hewlett *
 * * Packard Corporation. Possession, use, duplication or *
 * * dissemination of the software and media is authorized only *
 * * pursuant to a valid written license from Hewlett Packard *
 * * Corporation. *
 * * *
 * * RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure *
 * * by the U.S. Government is subject to restrictions as set *
 * * forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, *
 * * or in FAR 52.227-19, as applicable. *
 * * *
 * *****************************************************************
 */
#include <systype.h>
#include <socket.h>
#include <errno.h>
#include <in.h>
#include <in6.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>
Using AF_INET6 Sockets 235










