Envoy Application Programming Manual

Table Of Contents
ADM-2 Multipoint Supervisor Protocol
Envoy Application Programming Manual427159-001
7-41
Poll and READ Operation
Example 7-19 shows the line-control sequence and the program coding to poll the line
and read a message from terminal 2.
Example 7-19. Poll the Line and Read a Message from the Terminal
Application Process Terminal
line state = CONTROL
CALL READ(...)
| EOT 11p ENQ ->
| <- EOT
| EOT 22p ENQ ->
| <- EOT
| EOT 33p ENQ ->
| . <- EOT
| . .
| . .
| EOT 22p ENQ -> .
| <- message
(READ completes)
error = 0
line state = READ
MCW.<8:15> = 1
The program coding for the above operation is:
! open the line.
CALL OPEN (linename, linefnum);
IF THEN ...
! define the line to Envoy.
CALL DEFINELIST (linefnum, addr^list, addr^size, num^entries,
poll^count, poll^type);
IF < THEN ...
! poll the network.
CALL READ (linefnum,linebuf[-1], line^read^count,
line^count^read);
IF = THEN ! terminal responded to poll.
BEGIN
! save the message for processing (without MCW, STX,or
! ETX)
s^message ’:=’ s^linebuf[1] FOR
(msg^len := line^count^read - 4);
! process the message.
! ack the message and send the reply to the terminal.
CALL send (message, msg^len, mcw.8:15 + poll^count);
! see "Select" example.
END;
ELSE
BEGIN
!bad news.
END;