User Manual
Boomer II User Manual & Integrator’s Guide
________________________________
Appendix B - Sample Programs
BM210012WT09 131 Wavenet Technology
Initialisation and Login
zEstablishConnection() establishes the connection to the RNG, using
either TCP/IP or X.25. When either a DataTAC(D 4000 or DataTAC
6000 network is used, this is all that is needed for the server to connect
to the DataTAC network.
When a DataTAC 5000 network is being used, the server application
must login to the RNG to identify itself. The login message is encoded
using scr_EncodeLogin() with the host ID and password as specified
by the command line parameters. The encoded login message is then
sent to the RNG.
Before the program exits, the connection to the RNG is closed. No
special SCR processing is needed here.
Data Transfer
zSendData() is a function that sends data to the RNG, using TCP/IP or
X.25 as appropriate. zReceiveData() is a similar function used to
receive data from the RNG. These two routines hide the low-level
details of the X.25 or TCP/IP connection to the DataTAC network.
When the server application receives a message from the DataTAC
network, using zReceiveData(), the message is passed to
zHandleMessage(). This routine uses scr_Decode() to decode the
incoming data, and then uses a switch statement to process the
message.
All data transfer within the server program is interpreted using the
DataTAC network independent data message types, such as
SCR_FROM_NET and SCR_TO_NET messages. This makes the code
applicable to all DataTAC network versions and reduces the problems
in porting an application from one DataTAC network type to another.
The server application also handles message types SCR_LR, SCR_CI,
and SCR_DI, which are specific to the DataTAC 5000 network. These
message types will not be received on DataTAC 4000 or DataTAC
6000 networks, and therefore will not affect the operation of the
program.
All messages received from the DataTAC network result in a message
being output to the screen to indicate that the message was received.
Some message types, such as SCR_ACK or SCR_CI, require no further
processing other than the output of a message. Other message types,
such as SCR_FROM_NET or SCR_LR, require a response message to
be sent to the DataTAC network. This is handled by formatting the
response within the switch statement, and this response is sent to the
DataTAC network at the end of the zHandleMessage() function.