The PEEK MESSAGE
function can be used to wait for a message on a DOJO port.
The function returns FALSE
if the the message port is empty. On the contrary,
if it returns TRUE
, it is possible to fetch the message using the
GET MESSAGE
command.
Note that the message port behaves like a queue, that is, the first message
that is inserted is the first that is retrieved. Therefore, if a program sends three
messages in a row to the attention of the port of another, the receiving program
will receive the three messages in the same order.
Obviously, if several programs do the same thing, the messages will be
interspersed but, in the end, they will be in the same order.
= PEEK MESSAGE( portId )
sessionId = LOGIN( "user", "password" ) port = FIND( sessionId, "user2", "testApp" ) IF PEEK MESSAGE( port ) THEN PRINT "A message is arrived!" ENDIF
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
PEEK MESSAGE ↔ PkMsg
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS