HPlogo X25/9000: X.25/9000 Programmer's Guide > Chapter 6 Extended Features

Reestablishing Terminated Connections

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

Maintaining a connection over an X.25 network may not suit all applications. For example, a client may send a request to a server that may require processing for an extended period of time before a reply can be sent. It would not be economical to maintain the connection until data processing has been completed. A more cost-effective method is to clear the connection, then reestablish it from the server side when the server finishes processing the data.

Usually, in a CALL REQUEST packet, only the X.121 address of the interface being used is written into the calling address field. The ioctl(X25_WR_CALLING_SUBADDR) writes a subaddress as a suffix to the calling address field in the CALL REQUEST packet. The server can read this data and save it until the connection is reestablished.

If the server is using the X.25 interface, the getpeername() system call will return the subaddress information formatted in an x25addrstr structure. The server then stores the information (x25addrstr structure) until the server reestablishes the connection.

When protocol IDs are used, the reestablishment proceeds as discussed above. However, the server must know the protocol ID to which it will connect. The protocol ID can be stored in the user data field of the CALL REQUEST packet. This must be designed into the application on both side of the connection. There is no standard specifying the way to transfer the protocol ID of the caller through X.25.

Syntax for ioctl (X25_WR_CALLING_SUBADDR)

The ioctl (X25_WR_CALLING_SUBADDR) and its parameters are described below.

#include <x25/x25ioctls.h>
#include <x25/x25str.h>
/* define X25_MAX_HOSTADDR 15
* define X25_MAXHP1 X25_MAX_HOSTADDR+1
* define X25_MAX_PIDLEN 8
* struct x25addrstr {
* u_char x25hostlen;
* u_char x25pidlen;
* u_char x25pid[X25_MAX_PID_LEN];
* u_char x25_host[X25_MAXHP1]p
* }
*/
int err;
int sd;
struct x25addrstr subaddr;
err = ioctl(sd, X25_WR_CALLING_SUBADDR, &subaddr);

sd

Is a socket descriptor for an SVC socket which has not yet been connected.

X25_WR_CALLING_SUBADDR

Is the definition for the request.

subaddr

Indicates the subaddress to be added to the calling address field in the CALL REQUEST packet. Only the x25hostlen and x25_host from the x25addrstr structure are used. The x25hostlen field contains only the subaddress to be added to the calling address field. The rest of the address is supplied by X.25.