event

Send a message event.

Syntax

status = event ( target , method [ , TVargList [ , arg1 [ , arg2 [ , argN ] ] ] ] ) ;

Arguments

str target

str method

list TVargList (optional)

list arg1 (optional)

list arg2 (optional)

list argN (optional)

Return Value

str status

Exceptions

%ARGUMENT : Invalid arguments. Usage: status = event ( target , method [ , TVargList [ , arg1 [ , arg2 [ , argN ] ] ] ] ) ;

Description

The event method returns immediately with no REPLY message.

The query method blocks until one of the following events occur:

CONNECT() 
{
  /* Received connect message from sender.*/
  /* Send back confirmation message */
  TEXT = { "Connected to ", self () } ;
  event ( sender(),  "message", { &TEXT } ) ;
  
  /* Call the setup method to send a query */
  SETUP() ;
  return ;
}
SETUP() 
{
  /* Send $recipe and ask for runtime */
  arglist = { &$recipe,  "runtime" } ;
  timeout ( 10 ) ;
  on_timeout return TIMEOUT_HANDLER() ;
  ret = query ( "furn12@dec81z", "SETUP", arglist )  ;
  if ( ret == "%TIMEOUT" ) {
    /* TIMEOUT occurred, message not sent */
  }
}
/* Exit if a timeout occurs */
TIMEOUT_HANDLER 
{ 
  puts "Timeout occurred" ; 
  return "%TIMEOUT" ; } ;
}
            
/* Enable the connect method */
enable CONNECT ;
/* Enter IDLE state and wait for connect message */
idle() ;
        

Examples

To execute the example below, press or modify the example to try different variations.

Related Links

query , timeout