IPX/SPX Programming Manual

HP NonStop IPX/SPX Programming Manual528022-001
6-1
6 Sample Programs
This section contains sample programs that use the socket library routines defined in
Section 5, Library Routines, and that follow the guidelines in Section 3, Programming
Using the Socket Interface.
Sample NonStop IPX/SPX Programs
The following sample programs are provided in this section:
SPXII Server Program on page 6-1
Sample SPXII Client on page 6-3
SPXII Client Using SAP on page 6-4
SPXII Server Using SAP on page 6-6
IPX Client Program on page 6-9
IPX Server Program on page 6-10
Client and Server Programs Using SPXII
This subsection contains simple client programs and server programs that call the
socket library routines to communicate using the SPXII protocol.
SPXII Server Program
/*
* Sample SPX server program. This example waits
* on a "well known" port for incoming connection
* requests.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <socket.h>
#include <nv.h>
#include <netdb.h>
#include <cextdecs (FILE_CLOSE_)>
#define DATA_BUF_SIZE 512
#define WELL_KNOWN_PORT 0x5555
main(int argc, char *argv[])
{
struct sockaddr_nv snv, from;
Note. For details on how to compile and bind programs written in the HP C or TAL
programming languages, refer to the C/C++ Programmer’s Guide or the TAL Reference
Manual, respectively.