HP X.25/9000 Programmer's Guide
Chapter 4 51
Sending and Receiving Data
Data Transmission Requirements
Data Transmission Requirements
Once a VC has been connected, processes on either side of a VC can
transmit and receive data freely without distinctions between client and
server.
An application process can use the send() and write() system calls to
transmit data, and the recv() and read() system calls to receive data.
read() and write() calls have the advantage of being part of the UNIX
standard I/O package. They are also simple to use. Using send() and
recv() offers greater flexibility and control of data transmission. They
are the only calls that can be used for data in INTERRUPT packets.
The send(), recv(), read(), and write() calls can be mixed within a
program.
Sending Data
The send(2) and write() calls can be used anytime after a connection
has been established. The caller is blocked until the specified number of
bytes to be sent have been queued unless nonblocking I/O is being used
(see “Using Nonblocking I/O” for more information).
If the number of bytes to be transmitted is greater than the packet size,
the data will automatically be transmitted in a series of packets. Refer to
“Sending and receiving large messages” later in this section for more
information on how large messages are sent and received.
Syntax for send()
The syntax for the send() system call and its parameters are described
below. The syntax for write() is described in your HP-UX man pages.
#include <sys/types.h>
#include <sys/socket.h>
int count;
int sd;
char *msg;
int len, flags;
count = send(sd, msg, len, flags);
36960-90061.bk Page 51 Friday, November 10, 2000 3:42 PM










