ACC X.25 Protocol User's Guide

X.25 Application Programming
Sending and Receiving Data
Chapter 474
Sending and Receiving Data
Before you can send to or receive data from an X.25 Virtual Circuit, the
X.25 Link must be up, the VC ZLU must be enabled and activated, and
in the case of an SVC, a call must be established. The zcntl() routine is
used to enable and activate the VC ZLU and the ACC X.25 API routines
are used to establish a call on an SVC. Once these conditions are met,
you may send data using the zsend() routine and read data that has
arrived on the application’s program ZLU using the zread() routine. Note
that before inbound data from a VC ZLU is delivered to an applications
program ZLU, you must call the zset_rcvr() routine for each and every VC
ZLU whose inbound data is to be delivered to the application.
All application data is transmitted (or received) as the data field of a
data packet contained within the I-field of an information frame. All
level 2 and level 3 protocol headers and/or trailers are transparently
supplied by the protocol for outgoing messages and removed by the
protocol for incoming messages. Only the actual data to be transferred is
dealt with by the application program.
When reading inbound data from the application’s program ZLU queue,
care must be taken to examine the type of data that has arrived. The
zread() routine returns the ZCOM message header and the message data
buffer. The message header contains information on which VC ZLU the
data came from and what type of data the message represents. Note that
the message could contain inbound data from the VC ZLU, unsolicited
status information, or buffer completion status from a previous zsend()
call. The following example shows how to enable a VC, setup the VCs
receiver for inbound data, read a data message and interpret its
meaning: