HP X.25/9000 Programmer's Guide
52 Chapter4
Sending and Receiving Data
Data Transmission Requirements
sd Socket descriptor for a connected VC socket.
msg Pointer to the buffer containing the data to be transmitted over the VC.
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 the
msg
buffer in bytes.
flags Indicates the type of data and packet in which to send the data. If 0 is
specified, then X.25 sends a DATA packet containing the data. If the
out-of- band flag is set (OOB_MSG), then X.25 sends an INTERRUPT
packet containing the data. For details on sending interrupt data, refer
to Chapter 5 , “Receiving and Transmitting Out-of-band Information.”
count Returned value is either –1 or the number of bytes actually sent. If
count
is –1, then
errno
contains the error code. If
errno
returned
EINTR, a signal was received.
If a SIGURG signal is received during a send() call, the state of the VC
may have changed. Design your program to check the state of the VC
before attempting to send() data again after a SIGURG signal has
arrived.
Refer to the send(2) entry in your HP-UX man pages for more
information.
Receiving Data
The recv(2) and read(2) calls can be issued any time after a connection
has been established. The caller is blocked until there is a message
available for reception, unless nonblocking I/O is being used.
Nonblocking I/O is described later in this chapter. Refer also to “Sending
and receiving large messages” later in this section for information on
how large messages are sent and received.
Syntax for recv()
The syntax for the recv() system call and its parameters are described
below. The syntax for read() is described in your HP-UX man pages.
#include <sys/types.h>
#include <sys/socket.h>
int count;
36960-90061.bk Page 52 Friday, November 10, 2000 3:42 PM










