home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s038 / 1.ddi / SUPP.LIF / RCVRSVP.PLM < prev    next >
Encoding:
Text File  |  1992-07-06  |  1.9 KB  |  56 lines

  1. $title('rcvrsvp - respond to a request-response transaction')
  2. $compact
  3. /********************************************************************
  4.  *
  5.  *     MODULE NAME: rcvrsvp    
  6.  *
  7.  *     DESCRIPTION: When a message is received, send a response via
  8.  *                  rq$send$reply and exit. 
  9.  *
  10.  *
  11.  *********************************************************************/
  12.  
  13. rcvrsvp: DO;
  14.  
  15. $include(:rmx:inc/rmxplm.ext)
  16. $include(dcom.ext)
  17. $include(dcom.lit)
  18. $include(:rmx:inc/error.lit)
  19. $include(err.ext)
  20.         
  21.     DECLARE                /* Literals */
  22.  
  23.         TSTPORT     LITERALLY    '801H',     /* well-known port */
  24.         SFLAGS      LITERALLY    '00000B',   /* data buffer, synchronous flags*/
  25.         NOEXCEPT    LITERALLY   '0',        /* no exception handling by system */
  26.         DATATYPEMASK LITERALLY  '0FH';      /* data type part of flags */
  27.     
  28.  
  29.     DECLARE                /* Global vars */
  30.  
  31.         status       WORD,
  32.         port_t       TOKEN,      /* Token for local port */
  33.         info         rec_info,   /* info block on message received */
  34.         buf_pool     TOKEN,      /* buffer pool attached to port */
  35.         mes_buf(*)   BYTE initial (30,'This is a send$reply message',0dh,0ah),
  36.         tran_id      WORD,
  37.         con_buf    (20) BYTE,       /* control message buffer */    
  38.         msg_ptr      POINTER;    /* pointer to received message */        
  39.         
  40.         
  41.     CALL set$exception(NOEXCEPT);
  42.     port_t = get$dport(TSTPORT, @buf_pool, CHAIN, @status);
  43.     msg_ptr = rq$receive(port_t, WAITFOREVER, @info, @status);
  44.     CALL error$check(100, status);
  45.     tran_id = rq$send$reply(port_t, info.rem$socket,
  46.                             info.trans$id, @con_buf,
  47.                             @mes_buf, SIZE(mes_buf), SFLAGS, @status);
  48.     CALL error$check(110, status);
  49.     IF msg_ptr <> NIL THEN DO;
  50.         CALL rq$release$buffer(buf_pool, selector$of(msg_ptr),
  51.                                     (info.flags AND DATA$TYPE$MASK), @status);
  52.         CALL error$check(100, status);
  53.     END;
  54.     CALL rq$exit$io$job(0,NIL,@status);
  55. END rcvrsvp;
  56.