HP X.25/9000 Programmer's Guide
Chapter 3 27
Establishing and Terminating a Socket Connection
Connection Establishment for the Server Process
Connection Establishment for the Server
Process
This section describes the system calls and parameters executed by the
server process to establish a connection.
In the simplest case, there are four steps that the server process must
complete before a connection can be made with a client:
1. Create a socket with socket().
2. Bind an address to the new socket with bind().
3. Add a listen queue to the socket with listen().
4. Wait for an incoming call with accept().
NOTE Take care to avoid issuing contradictory system calls when porting
applications for operation with BSD IPC sockets. You cannot, for
example, issue a connect() call on a socket on which you have
previously issued a bind() call. Conflicting system calls will return the
EOPNOTSUPP (223) error message.
Creating a Socket
Before any other BSD IPC system call is executed, the server process
must call socket() to create a BSD IPC socket.
Syntax for socket()
The socket() system call and its parameters are described below.
#include <sys/types.h>
#include <x25/ccittproto.h>
#include <sys/socket.h>
int sd;
int af, type, protocol;
sd = socket(af, type, protocol);
af Identifies the socket’s address family. For X.25 programmatic access, you
36960-90061.bk Page 27 Friday, November 10, 2000 3:42 PM










