Back to Contents


The MessageServer class

Warning: This feature is experimental and subject to change.

Summary:

See also: Classes and Objects, Form Specification File


Syntax

The MessageServer class allows a program to send a key action over the network to other programs using this service. The action transmission is not guaranteed.

Syntax:

base.MessageServer


Methods:

Class Methods
Name Description
connect() Connects to the group of programs to be notified by a message.
send( keyname STRING ) Sends a key event to the group of programs connected together.

Usage:

The MessageServer class can be used to join a group of programs to be notified by simple messages (i.e. key events). The programs can run on different machines connected together in a network.

Note that the MessageServer uses network API capabilities with Sockets and the UDP protocol. While this is obvious, make sure the computers are configured with a network. Note that the UDP protocol does not guarantee the transmission of datagrams. Therefore, messages sent with the MessageServer can arrive out of order, duplicated, or go missing without notice.

The UDP port used is 6600, the IP address group is 224.0.1.1, and this cannot be changed.

Connecting to the group

First the program must call the base.MessageServer.connect() class method to join the group of programs that can be notified by a message.

Sending a message

Once connected to the message server group, a program can call the base.MessageServer.send() class method to notify other programs registered to the group.

01 CALL base.MesageServer.connect()
02 CALL base.MessageServer.send("f1")

All programs registered to the message server group (including the program which has sent the message) will be notified. The messages can be treated by the current dialog with a simple ON KEY() interaction block.


Examples

Example 1: Simple MessageServer usage

01 MAIN
02   CALL base.MessageServer.connect()
03   MENU "test"
04       COMMAND "send F1" CALL base.MessageServer.send("f1")
05       ON KEY (F1) DISPLAY "Key F1 received..."
06       COMMAND "quit" EXIT MENU
07   END MENU
08 END MAIN