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

  1. $compact optimize(3) debug pw(79) rom
  2.  
  3.  
  4. /***********************************************************************
  5.  **                                                                   **
  6.  **                                                                   **
  7.  **   OBJECTIVE : To demonstrate how one can send or receive a        **
  8.  **               MULTIBUS-II signal (a 4 byte data-less message)     **
  9.  **               to a remote agent using the Nucleus Communication   **
  10.  **               Service of the iRMX II/III Operating Systems.       **
  11.  **                                                                   **
  12.  **                                                                   **
  13.  **    USAGE:                                                         **
  14.  **                                                                   **
  15.  **    This program can be executed on any MULTIBUS-II board          **
  16.  **    running the iRMX II/III Operating Systems.                     **
  17.  **    The board must be situated in slot CLIENT$PSB$SLOT, where      **
  18.  **    CLIENT$PSB$SLOT and SERVER$PSB$SLOT are defined in utils.lit.  **
  19.  **                                                                   **
  20.  **                                                                   **
  21.  **   ALGORITHM : 1. Enable in-line exception handling feature.       **
  22.  **                                                                   **
  23.  **               2. Send a signal to the agent in slot               **
  24.  **                  SERVER$PSB$SLOT.                                 **
  25.  **                                                                   **
  26.  **               3. Wait for an acknowledge signal from agent        **
  27.  **                  running in slot SERVER$PSB$SLOT.                 **
  28.  **                                                                   **
  29.  **               4. Display "SIGNAL ACKNOWLEDGED" message to console.**
  30.  **                                                                   **
  31.  **               5. Repeat steps 2 - 5                               **
  32.  **                                                                   **
  33.  **                                                                   **
  34.  ***********************************************************************/
  35.  
  36. client: DO;
  37.  
  38. $INCLUDE (utils.lit)
  39. $INCLUDE (utils.ext)
  40.  
  41. $INCLUDE (:RMX:inc/nuclus.ext)
  42. $INCLUDE (:RMX:inc/bios.ext)
  43. $INCLUDE (:RMX:inc/eios.ext)
  44. $INCLUDE (:RMX:inc/hi.ext)
  45. $INCLUDE (:RMX:inc/udi.ext)
  46.  
  47. DECLARE eh_handler            EX_HANDLER_STRUCT,
  48.         inbuffptr            POINTER,
  49.         port$info$struc        SIG_PORT_INFO_STRUCT,
  50.         port$tkn            TOKEN,
  51.         server$socket        DWORD,
  52.         socket                DWORD,
  53.         status                WORD,
  54.         trans$id            WORD,
  55.         message  (*)        BYTE    DATA
  56.                             (32,'Signal Has Been Sent To Server',CR,LF,0),
  57.         message2 (*)        BYTE    DATA
  58.                             (38,'Signal Has Been Received From Server',CR,LF),
  59.         response$p(255)        BYTE,
  60.         control$ptr(20)        BYTE,
  61.         count                BYTE,
  62.         server$socket$ovl    STRUCTURE    (psb$slot    WORD,
  63.                                          port$id    WORD)
  64.                              AT    (@server$socket);
  65.  
  66.  
  67. /**********************************************************************
  68.  ************************ MAIN PROGRAM BEGINS *************************
  69.  **********************************************************************/
  70. main:
  71.  
  72.     /*    Enable in-line exception handling    */
  73.     CALL rq$get$exception$handler(@eh_handler,@status);
  74.     eh_handler.mode = 0;
  75.     CALL rq$set$exception$handler(@eh_handler,@status);
  76.  
  77.     /*    Create the communication port object for this board    */
  78.     port$info$struc.message$id    = SERVER$PSB$SLOT;    /*    Destination Board    */
  79.     port$info$struc.reserved1    = 0;
  80.     port$info$struc.type        = SIGNAL$SERVICE;    /*    Transport Protocol    */
  81.     port$info$struc.reserved2    = 0;
  82.     port$info$struc.flags        = FIFO$PORT$QUEUEING;
  83.     port$tkn = rq$create$port (0, @port$info$struc,@status);   
  84.     CALL check$exception( @(14,'rq$create$port'), status);
  85.  
  86.     DO count = 0 TO 5;
  87.  
  88.         /*    Print the signal message on the terminal.    */
  89.         CALL rq$c$send$co$response(nil,0,@message,@status);
  90.         CALL check$exception( @(21,'rq$c$send$co$response'), status);
  91.  
  92.         /*    Send a signal to the Server    */
  93.         CALL rq$send$signal(port$tkn,@status); 
  94.         CALL check$exception( @(14,'rq$send$signal'), status);
  95.  
  96.         /*    Receive a signal response from the server    */
  97.         CALL rq$receive$signal(port$tkn,WAIT$FOREVER,@status);
  98.         CALL check$exception( @(17,'rq$receive$signal'), status);
  99.  
  100.         /*    Print the response message on the terminal.    */
  101.         CALL rq$c$send$co$response(nil,0,@message2,@status);
  102.         CALL check$exception( @(21,'rq$c$send$co$response'), status);
  103.  
  104.     END;    /*    DO count = 0 TO 5    */
  105.  
  106.     /*    Clean up    */
  107.     CALL rq$delete$port(port$tkn, @status);
  108.     CALL check$exception( @(14,'rq$delete$port'), status);
  109.  
  110.     /*    Exit gracefully    */
  111.     CALL rq$exit$io$job(0,NIL, @status);
  112.     CALL check$exception( @(14,'rq$exit$io$job'), status);
  113.  
  114. END client;    /*    End of module    */
  115.