IPX/SPX Programming Manual
Sample Programs
HP NonStop IPX/SPX Programming Manual—528022-001
6-10
Client and Server Programs Using IPX
 snv.snv_addr.s_net[1] = 0x00;
 snv.snv_addr.s_net[2] = 0x00;
 snv.snv_addr.s_net[3] = 0x00;
 snv.snv_addr.s_host[0] = 0x08;
 snv.snv_addr.s_host[1] = 0x00;
 snv.snv_addr.s_host[2] = 0x8E;
 snv.snv_addr.s_host[3] = 0x00;
 snv.snv_addr.s_host[4] = 0x2E;
 snv.snv_addr.s_host[5] = 0x18;
 snv.snv_addr.s_port = WELL_KNOWN_PORT;
 /*
 * Send data to remote. Note that the number of bytes
 * sent could be less than DATA_BUF_SIZE.
 */
 bytesSent = sendto(sock, buf, DATA_BUF_SIZE, 0,
 (struct sockaddr *)&snv, sizeof(snv));
 if (bytesSent == -1) {
 perror("send failure");
 exit(1);
 }
 printf("IPX Client: sent %d bytes to port 0x%hx\n",
 bytesSent, snv.snv_addr.s_port);
 exit(0);
}
IPX Server Program
/*
 * Sample IPX server program.
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <socket.h>
#include <nv.h>
#include <netdb.h>
#define DATA_BUF_SIZE 512
#define WELL_KNOWN_PORT 0x5444
main(int argc, char *argv[])
{
 struct sockaddr_nv snv;
 char buf[DATA_BUF_SIZE];
 int bytesReceived;
 int sock;
 int len = sizeof(snv);
 /*
 * Specify the name of the NonStop IPX/SPX
 * Protocol Process if required.
 */
 socket_set_nv_name("$NV2A");
 /*










