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

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