Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Server Name Broadcast Feature

It is possible for clients to listen for an available FairCom Server without knowing the Server Name in advance. Typically, client applications must know the Server Name of the FairCom Server, which is customer configurable, and the host name for the machine running the FairCom Server. This required a lot of coordination on the part of the Administrator or the developer. The FairCom Server can be configured to broadcast its Server Name and IP address over a TCP/IP port. With this method, it is possible for a client to detect the various FairCom Servers operating on the network and obtain their Server Names, including IP addresses.

These server keywords support the broadcast feature: BROADCAST_PORT, BROADCAST_INTERVAL, and BROADCAST_DATA. See the examples in FairCom DB Configuration Options.

  • BROADCAST_PORT specifies the TCP/IP port used for the broadcast.

    The default value is 0, which means the broadcast is off.

    If DEFAULT is specified, this means that the broadcast is on and the default port is used, which is 5595.

    Any valid four-byte integer greater than 5000 that is not in use by another process may be specified. This should NOT be the port for the FairCom Server, which is displayed at startup and is based on the Server Name. See the examples below.

  • BROADCAST_INTERVAL determines the number of seconds between broadcasts. The default is 10 seconds, otherwise the token should be a number.

    If the number is negative, each broadcast is also sent to the FairCom Server standard output.

    To prevent unreasonable values, the maximum value allowed is set to 86,400 seconds, which is once per day.

  • BROADCAST_DATA specifies a token to be broadcast following the Server Name. The token must not contain spaces. The Server Name will be followed by a vertical bar character, ‘|’, which is followed by the token. There is no default token.

Using the following sample keywords and assuming the host IP address was 127.0.0.1, the FairCom Server broadcasts “SAMPLE | 127.0.0.1 | 5451| FAIRCOM_SERVER” on port 6329 every 90 seconds:

SERVER_NAME SAMPLE

BROADCAST_PORT 6329

BROADCAST_INTERVAL 90

BROADCAST_DATA FAIRCOM_SERVER

When the FairCom Server broadcasts, it sends the Server Name specified in the configuration file, “FAIRCOMS” by default, with an at-sign, ‘@’, followed by the FairCom Server host IP address. If a BROADCAST_DATA token was also specified, this is followed by a vertical bar character, ‘|’, which is followed by the token.

On the client side, GetServerInfo() listens on the default port and stores the broadcast string in buffer. See GetServerInfo for more information. GetServerInfoXtd() listens on the specified port and stores the broadcast string in buffer. See GetServerInfoXtd for more information. See ctixmg.c for an example implementation of this feature.

TOCIndex