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

  1. $title('sndmsg - send a message to a known port')
  2. $compact
  3. sndmsg: DO;
  4.  
  5.  
  6. $include(:rmx:inc/rmxplm.ext)
  7. $include(dcom.ext)
  8. $include (dcom.lit)
  9. $include(:rmx:inc/error.lit)
  10. $include(err.ext)
  11.  
  12. /********************************************************************
  13.  *
  14.  *     MODULE NAME: sndmsg    
  15.  *
  16.  *     DESCRIPTION: Create a data port and send a short message to a well-known
  17.  *                  host and port.
  18.  *
  19.  *********************************************************************/
  20.  
  21. DECLARE      /* Literals */
  22.  
  23.     REMPORT     LITERALLY  '801H',   /* Port id of remote port */    
  24.     REMHOST     LITERALLY  '05',     /* Host id of remote host, this must match
  25.                                         hostid of remote agent */
  26.     CONBUF      LITERALLY  '16',     /* size of a control buffer */
  27.     TSTPORT     LITERALLY  '801H',   /* well-known port */
  28.     NOEXCEPT    LITERALLY   '0',     /* no exception handling by system */
  29.     SFLAGS      LITERALLY  '00000B'; /* data buffer, synchronous flags*/
  30.  
  31. DECLARE     /* Global vars */
  32.  
  33.         status      WORD,
  34.         port_t      TOKEN,                 /* Token for local port */
  35.         messock     socket,                /* socket to which message is sent */
  36.         msock       DWORD AT (@messock),   /* dword alias for messock */
  37.         con_buf    (CONBUF) BYTE,             /* control buffer */
  38.         mess_size   DWORD,                 /* number of bytes in data message */
  39.         bpool       TOKEN,                 /* buffer pool attached to port */
  40.         trans_id    WORD,                  /* transaction id */
  41.         mes_buf(*)  BYTE INITIAL (26,'This is a simple message',0dh,0ah);
  42.                     
  43.     CALL set$exception(NOEXCEPT);
  44.     port_t = get$dport(TSTPORT, @bpool, CHAIN, @status);
  45.     messock.host_id = REMHOST;
  46.     messock.port_id = REMPORT;
  47.     mess_size = size(mes_buf);
  48.     trans_id = rq$send(port_t,msock, @con_buf, @mes_buf, mess_size,
  49.                          SFLAGS, @status); 
  50.     CALL error$check(100, status);
  51.     CALL rq$exit$io$job(0,NIL,@status);
  52.  
  53. END sndmsg;                                        
  54.