HP X.25/9000 Programmer's Guide
64 Chapter4
Sending and Receiving Data
Setting Buffer Thresholds and Sizes
err = ioctl(sd, X25_WR_WTHRESHOLD, &thresh);
sd Socket descriptor for a VC socket.
X25_WR
_WTHRESHOLD
Indicates that the write threshold is being changed.
thresh New value for the write threshold.
err On successful completion,
err
is set to 0. Otherwise, a value of –1 is
returned and
errno
is set to indicate the error.
Setting the Read Message Fragment Size
X.25 assumes that all VCs will read whole messages with a single
read() or recv() system call. This is usually the most efficient use of
the VC. A message is a set of packets that all have their M bits set to 1
(except the last packet).
Connections over most VCs do not use extremely long messages, and the
maximum size of a read() or recv() buffer is usually sufficiently large.
However, if at any time during the connection the application anticipates
that the VC will receive messages longer than the maximum read() or
recv() buffer size, it must set the read message fragment size to a value
greater than 0.
The read() and recv() calls return the number of bytes equal to the
fragment size set in the last ioctl(X25_SET_FRAGMENT_SIZE)call. The
ioctl(X25_NEXT_MSG_STAT) call is used to indicate the necessary buffer
size in all instances.
When reading a long message requiring several read() or recv() calls,
you must use the ioctl(X25_NEXT_MSG_STAT) call to detect the end of
the message. When this call returns the
x25_msg_flags
value with the
X25_MDTF_BIT
set to 0,the next read() or recv() system call will return
the end of the message.
To avoid data collision problems, issue the
ioctl(X25_SET_FRAGMENT_SIZE) call before the connect() call, or
between the accept() and the ioctl(X25_SEND_CALL_ACEPT) calls.
The ioctl(X25_SET_FRAGMENT_SIZE) call and its parameters are
described below.
36960-90061.bk Page 64 Friday, November 10, 2000 3:42 PM










