HP X.25/9000 Programmer's Guide

Chapter 3 35
Establishing and Terminating a Socket Connection
Connection Establishment for the Client Process
Syntax for connect()
The connect() system call and its parameters are described below.
#include <sys/types.h>
#include <x25/x25addrstr.h>
#include <sys/socket.h>
int err;
int sd;
struct x25addrstr to_addr;
int to_addrlen;
err = connect(sd, &to_addr, to_addrlen);
sd Socket descriptor returned by a previous socket() system call. It must
use the AF_CCITT address family.
to_addr The x25addrstr structure containing the local interface to be used in the
call, as well as the X.121 address and subaddress of the remote server
process with which the client process will establish an SVC.
to_addrlen Contains the length of the x25addrstr struct (in bytes) pointed to by
to_addr
.
err If the call completes successfully,
err
contains 0. If the system call
encountered an error, –1 is returned in
err
and
errno
contains the error
number.
The connect() call transmits a CALL REQUEST packet and blocks the
process until the connection is ready (unless you specify nonblocking
mode).
If you place a call by issuing connect() on a socket which is nonblocking,
your process will not block. Your request will return EINPROGRESS. This
means that the process of connecting to the remote system has been
initiated.
If your host system has more than one X.25 interface and those
interfaces do not have equal connectivity, you must specify the
x25ifname
field of the x25addstr structure. That field designates which
interface must be used for the connection. If your system has only one
interface, it is not necessary to specify the
x25ifname
field.
If the
x25ifname
field is null,the connect() call sends outbound packets
to the first initialized interface by default.
36960-90061.bk Page 35 Friday, November 10, 2000 3:42 PM