HP X.25/9000 Programmer's Guide

70 Chapter5
Receiving and Transmitting Out-of-band Information
Receiving Out-of-band Events
*/
vec.sv_handler = onurg;
vec.sv_mask; = 0
vec.sv_onstack = 0;
if (sigvector(SIGURG, &vec, 0) < 0) {
perror(”sigvector(SIGURG)”);
}
In addition to installing the signal handler, you must also call
ioctl(SIOCSPGRP) to ensure that the SIGURG signal is delivered when
the out-of-bound data is received, as shown in the code example below.
Refer to the socket(7) man page for more information about the
ioctl(SIOCSPGRP) call.
setsigskt(s)
int s;
{
int pid;
/* enables the current process to receive SIGURG
* when the socket has urgent data;
*/
pid = getpid();
/* Note that specifying the process id in the next ioctl()
* means that only this process shall receive the SIGURG
* signal.
If (-1)*getpid() is used instead,
the entire
*
process group (including
* parents and children) will receive the SIGURG signal.
*/
if (ioctl(s, SIOCSPGRP, (char *) &pid) < 0) {
perror (”ioctl(SIOCSPGRP)”);
}
Once installed, the signal handler is called whenever the specified signal
arrives. While a signal handler is executing, additional signals of the
same type are blocked from arrival. All signals sent by a socket should be
handled by the process which is controlling the VC to ensure process
continuity.
36960-90061.bk Page 70 Friday, November 10, 2000 3:42 PM