From MdsWiki
MDSplus events allow processes to wait for a named occurrence that is generated by another application. Users can specify MDSplus events in graphics applications such as dwscope and jScope which would signal that the data required for the plot is now available so that these plots will update automatically.
Simple Configuration Settings
Originally the MDSplus event system utilized a client/server approach for transmitting events to other systems on both the local area network and the wide are network. The more recent MDSplus event system uses udp multicast packets for broadcasting events on the local area network. This is much more efficient and less prone to lock ups due to misbehaving client applications. There are several environment variables that will effect the behavior of event communications listed in the table below.
Environment Variable | Description | Default |
---|---|---|
mds_event_target | If defined, any application that sets/issues an MDSplus event will connect to the host and port specified in the environment variable and the remote connection will issue the event using the method configured by environment variables on that remote system. For example, setting mds_event_target to myhost:8010 will cause an application setting an event to connect to myhost on port 8010 and have the mdsip server on the remote end issue the event on the clients behalf. | Not set |
mds_event_server | If defined, any application that waits for an MDSplus event will connect to the host and port specified in the environment variable and wait for the event using the method configured by environment variables on that remote system. For example, setting mds_event_server to myhost (if no port specified it defaults to port 8000) will cause an application waiting for event notification to connect to myhost and have the mdsip server on the remote end wait for the event on the clients behalf. | Not set |
mdsevent_address | If defined it must define a multicast address range to use for broadcasting MDSplus events on the local area network. The format of the string for the environment variable is n1.n2.n3.n4-n5. For example, if the mdsevent_address environment variable is set to 224.0.10.10-20, addresses 224.0.10.10, 224.0.10.11,...,224.0.10.20 will be used for transmission of MDSplus events. The choice of the last digit value in the ipv4 address is based on a hash of the event name. Note: Multicast address ranges are limited so before you set this environment variable you should look at theIPv4 Multicast Address Space Registry for possible addresses. Network routers and switches only pass certain multicast packets based on the address used. Whether you use the default address or override it with this environment variable, you should make sure your system firewall and local network switches permit the transmission of packets to these addresses. | If this environment variable is not defined then events are transmitted using the address 224.0.0.175. |
mdsevent_port | If defined, it specifies the port number used for transmitting events. | If not defined, port 4000 is used. |
Advanced Configuration Settings
There are additional event configurations that can be set using an xml configuration file or environment variables. These include:
XML property | Environment Variable | Description | Default |
---|---|---|---|
PORT | mdsevent_port | You can specify a numeric port or a named port to use for MDSplus events. | 4000 |
ADDRESS | mdsevent_address | The address is the ip address used when sending multicast event messages. A single address can be used
or a range of ports (last part of ipv4 address) can be specified using a format such as n1.n2.n3.n4-n5. For example, specifying 224.0.0.1-255 will use 255 addresses between 224.0.0.1 and 224.0.0.255 for sending event messages. The actual ip address used will be determined by a hash value computed from the event name being issued. | 224.0.0.175 |
IP_MULTICAST_TTL | mdsevent_ttl | The multicast time to live setting is used by network routers and switches to determine whether or not
to transmit the multicast packets to external networks. The default setting is 1 which will contain the MDSplus event packets to the local area network. If your network is configured with VLAN's you may need to increase this setting to ensure systems on these VLAN's will receive the event messages. | 1 |
IP_MULTICAST_LOOP | mdsevent_loop | This setting accepts a value of 0 or 1. If set to 0, events issued on this system will only be seen
by applications running on other systems. Processes running locally on this system will not receive MDSplus events. The default value is 1 and it is unlikely that you would want to change this value. | 1 |
IP_MULTICAST_IF | mdsevent_interface | This setting can specify which network interface you want to use for sending MDSplus event messages.
This setting is only available on linux systems. Normally systems are configured with a default network interface to use so you would not likely need to set this. | system default |
To configure these settings using an xml configuration file you can copy the sample configuration file in $MDSPLUS_DIR/xml/eventsConfig.xml to either $HOME/.mdsplus.config/ (for user specific configuration) or to $MDSPLUS_DIR/local/ for system wide settings. There is a comment section of that xml file explaining the settings. The actual settings are find in a simple xml entry which looks like:
<UdpEvents IP_MULTICAST_TTL="1" IP_MULTICAST_LOOP="1" IP_MULTICAST_IF="" PORT="4000" ADDRESS="224.0.0.175"/>
NOTE: The environment variables and/or xml configuration settings are only processed once by a process when issuing or listening for MDSplus events. You cannot, for instance, switch back and forth between multiple network interfaces in a single process by changing the mdsevent_interface environment variable. If this functionality is required you could possibly use a subprocess to set the event.