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

  1. $title('sndrsvp - initiate a request-response transaction')
  2. $compact
  3. /********************************************************************
  4.  *
  5.  *     MODULE NAME: sndrsvp    
  6.  *
  7.  *     DESCRIPTION: Send a transaction request to a well-known socket.
  8.  *                  The request is sent as an unsolicited message,
  9.  *                  i.e., with no data part.  Wait for a response and
  10.  *                  print the message on the console.
  11.  *
  12.  *********************************************************************/
  13.  
  14. sndrsvp: DO;
  15.  
  16. $include(:rmx:inc/rmxplm.ext)
  17. $include(dcom.ext)
  18. $include (dcom.lit)
  19. $include(:rmx:inc/error.lit)
  20. $include(err.ext)
  21.              
  22. DECLARE                /* Literals */
  23.  
  24.     REMPORT     LITERALLY   '801H',     /* Port id of remote port */    
  25.     REMHOSTID   LITERALLY   '3',        /* hostid of remote host */
  26.     CONBUF      LITERALLY   '20',       /* control buffer size */
  27.     RSVPB       LITERALLY   '128',      /* rsvp buffer size */
  28.     TSTPORT     LITERALLY   '801H',     /* well-known port */
  29.     NOEXCEPT    LITERALLY   '0',        /* no exception handling by system */
  30.     SFLAGS      LITERALLY   '00000B';   /* data buffer, synch, rcvreply flags*/
  31.     
  32.     DECLARE        /* Global vars */
  33.  
  34.         status           WORD,
  35.         port_t           TOKEN,                 /* Token for local port */
  36.         messock          socket,                /* socket to which message is sent */
  37.         msock            DWORD AT (@messock),    /* dword alias for messock */
  38.         con_buf    (CONBUF) BYTE,                  /* control buffer */
  39.         rsvp_buf (RSVPB) BYTE,                  /* rsvp buffer */
  40.         mess_size        DWORD,                 /* number of bytes in data message */
  41.         rsvp_size        DWORD,                 /* rsvp buffer size */
  42.         rsvp_ptr         POINTER,               /* points to rsvp message */
  43.         info             rec_info,              /* receive info block */
  44.         buf_pool         TOKEN,                 /* buffer pool attached to port */        
  45.         trans_id         WORD;                  /* transaction id */
  46.             
  47.     CALL set$exception(NOEXCEPT);
  48.     port_t = get$dport(TSTPORT, @buf_pool, CHAIN, @status);
  49.     messock.host_id = REMHOSTID;
  50.     messock.port_id = REMPORT;
  51.     mess_size = 0;
  52.     rsvp_size = RSVPB;    
  53.     trans_id = rq$send$rsvp(port_t,msock, @con_buf, NIL,
  54.                              mess_size, @rsvp_buf, rsvp_size, SFLAGS, @status);
  55.     CALL error$check(100, status);
  56.     rsvp_ptr = rq$receive$reply(port_t, trans_id, WAITFOREVER, @info, @status);
  57.     CALL error$check(110, status);
  58.     call rqc$send$eo$response(NIL,0,@rsvp_buf,@status);
  59.     CALL error$check(120, status);
  60.     call rq$exit$io$job(0,NIL,@status);
  61.  
  62. end sndrsvp;    
  63.