HP X.25/9000 Programmer's Guide
Chapter 4 63
Sending and Receiving Data
Setting Buffer Thresholds and Sizes
Setting Buffer Thresholds and Sizes
X.25 allows developers to fine-tune socket behavior by specifying certain
characteristics such as when a socket allows information to be written to
its buffers (is “writable”). This is done by setting the threshold values
that control the size of the three socket buffers: outbound message, send,
and receive.
Setting the Write Buffer Threshold
The write buffer threshold is used to determine if there is enough buffer
space available to send another message without blocking the socket. If
the buffer space available is greater than or equal to the write threshold,
the socket will indicate writable when a select() call is issued. The
ioctl(X25_WR_WTHRESHOLD) call is used to set the write threshold
value.
The value specified with ioctl(X25_WR_THRESHOLD) affects send(),
write(), and select(). Whenever a send() or write() call is issued,
the amount of space remaining in the send socket buffer is checked (that
is, the amount of data in the outbound queue is subtracted from the size
of the send socket’s buffer). This check is done using network memory
units and is therefore subject to round-off error. If this remaining space
is insufficient to accept another message (the remaining space is less
than the write threshold size), the free space size for the send socket is
forced to zero and remains that way until enough data is moved to the
X.25 interface. If another send() or write() call is issued during this
time, the call is blocked (for nonblocking I/O, EWOULDBLOCK is
returned).
The ioctl(X25_WR_WTHRESHOLD) call and its parameters are described
below.
Syntax for ioctl (X25_WR_WTHRESHOLD)
The syntax for the ioctl(X25_WR_WTHRESHOLD) system call and its
parameters are described below.
#include <x25/x25ioctls.h>
#include <x25/x25str.h>
int err;
int sd, thresh;
36960-90061.bk Page 63 Friday, November 10, 2000 3:42 PM










