HP X.25/9000 Programmer's Guide
Chapter 4 53
Sending and Receiving Data
Data Transmission Requirements
int sd;
char *buf;
int len, flags;
count = recv(sd, buf, len, flags);
sd Socket descriptor for a connected VC socket.
buf Pointer to the buffer which will receive the data message. Although this
is a character buffer, X.25 has no requirement that the data actually be
ASCII characters. This is entirely up to the application.
len Length of
buf
in bytes. If the message or message fragment available to
be read is larger than the value specified in
len
, the remainder of the
message or message fragment will be discarded. Once the data has been
read it is discarded. Setting the peek flag
MSG_PEEK
allows a message to
be received without any data being discarded. The number of bytes to be
read can be obtained with ioctl(X25_NEXT_MSG_STAT), described later
in this chapter.
flags Indicates the type of data to be read and whether or not to discard the
message after reception. If 0 is specified, then X.25 returns data
transmitted in normal DATA packets. If the peek flag
MSG_PEEK
is set,
the data is copied into the buffer, but not discarded afterwards. If the
out-of-band flag is set
(OOB_MSG)
, then the call never blocks and X.25
returns data from the out-of-band queue. If
OOB_MSG
is set and no
out-of-band data is available, recv() returns 0. For more information on
receiving interrupt data, refer to Chapter 5 , “Receiving and
Transmitting Out-of-band Information.”
count Either –1 or the number of bytes actually copied into
buf
. If count is –1,
then
errno
contains the error code. If
errno
returned
EINTR
, a signal
was received. Correct the cause of the error before attempting to recv()
data again. If the out-of-band flag is set (
OOB_MSG
), then the call never
blocks and X.25 returns data from the out-of-band queue.
Unless nonblocking I/O is being used, recv() blocks until a complete
X.25 message arrives, a signal arrives (for example,
SIGURG
), or the VC is
terminated. Nonblocking I/O is described later in this chapter.
Sending and Receiving Large Messages
When a message is too large to be sent in a single DATA packet, it is
36960-90061.bk Page 53 Friday, November 10, 2000 3:42 PM










