home *** CD-ROM | disk | FTP | other *** search
- $title('rcvrsvp - respond to a request-response transaction')
- $compact
- /********************************************************************
- *
- * MODULE NAME: rcvrsvp
- *
- * DESCRIPTION: When a message is received, send a response via
- * rq$send$reply and exit.
- *
- *
- *********************************************************************/
-
- rcvrsvp: DO;
-
- $include(:rmx:inc/rmxplm.ext)
- $include(dcom.ext)
- $include(dcom.lit)
- $include(:rmx:inc/error.lit)
- $include(err.ext)
-
- DECLARE /* Literals */
-
- TSTPORT LITERALLY '801H', /* well-known port */
- SFLAGS LITERALLY '00000B', /* data buffer, synchronous flags*/
- NOEXCEPT LITERALLY '0', /* no exception handling by system */
- DATATYPEMASK LITERALLY '0FH'; /* data type part of flags */
-
-
- DECLARE /* Global vars */
-
- status WORD,
- port_t TOKEN, /* Token for local port */
- info rec_info, /* info block on message received */
- buf_pool TOKEN, /* buffer pool attached to port */
- mes_buf(*) BYTE initial (30,'This is a send$reply message',0dh,0ah),
- tran_id WORD,
- con_buf (20) BYTE, /* control message buffer */
- msg_ptr POINTER; /* pointer to received message */
-
-
- CALL set$exception(NOEXCEPT);
- port_t = get$dport(TSTPORT, @buf_pool, CHAIN, @status);
- msg_ptr = rq$receive(port_t, WAITFOREVER, @info, @status);
- CALL error$check(100, status);
- tran_id = rq$send$reply(port_t, info.rem$socket,
- info.trans$id, @con_buf,
- @mes_buf, SIZE(mes_buf), SFLAGS, @status);
- CALL error$check(110, status);
- IF msg_ptr <> NIL THEN DO;
- CALL rq$release$buffer(buf_pool, selector$of(msg_ptr),
- (info.flags AND DATA$TYPE$MASK), @status);
- CALL error$check(100, status);
- END;
- CALL rq$exit$io$job(0,NIL,@status);
- END rcvrsvp;
-