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

  1. $title('smsg - send a 2K message to a known port')
  2. $compact
  3. /********************************************************************
  4.  *
  5.  *     MODULE NAME: smsg    
  6.  *
  7.  *     DESCRIPTION: send a 2K message in order to force data chaining since
  8.  *                  the receiving process has only allocated 1K buffers. 
  9.  *                  The data is contiguous on the sender's side but is
  10.  *                  received as a data chain by the receiver
  11.  *
  12.  *
  13.  *********************************************************************/
  14.  
  15. smsg: 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.     REMHOST     LITERALLY   '05',      /* Host id of remote host */
  27.     FATALERR    LITERALLY   '3',       /* fatal error code */
  28.     CONBUF      LITERALLY   '16',      /* size of a control buffer */
  29.     TSTPORT     LITERALLY   '801H',    /* well-known port */
  30.     NOEXCEPT    LITERALLY   '0',       /* no exception handling by system */
  31.     SFLAGS      LITERALLY   '00000B';  /* data buffer, synchronous 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.         mbuf(2052)  BYTE INITIAL(50,'This is the first buffer received via data chain',0ah,0dh),
  41.         mess_size   DWORD,               /* number of bytes in data message */
  42.         bpool       TOKEN,               /* buffer pool attached to port */
  43.         trans_id    WORD;                /* transaction id */
  44.  
  45.     CALL set$exception(NOEXCEPT);
  46.     port_t = get$dport(TSTPORT, @bpool, CHAIN, @status);
  47.     CALL MOVB(@(57,'This message was in the second buffer in the data chain',0dh,0ah),@mbuf(1026), 58);
  48.     messock.host_id = REMHOST;
  49.     messock.port_id = REMPORT;
  50.     mess_size = size(mbuf);
  51.     trans_id = rq$send(port_t,msock, @con_buf, @mbuf, mess_size,
  52.                          SFLAGS, @status); 
  53.     CALL error$check(100, status);
  54.     CALL rq$exit$io$job(0,NIL,@status);
  55.  
  56. END smsg;                                        
  57.