Relay Server was included in a major update to RaceTools in version 2.56. It was added to address the connection restrictions in the WEC data feed, but this feature is also useful for non-WEC users. The Relay Server redistributes the data stream from one instance of RaceTools to other copies of RaceTools. This can be used to reduce network traffic to the data source, limit the number of machines connected to the pit lane network, or to synchronize clients in a replay scenario (such as for learning the software) without using another tool like IPBroadcaster.
The RaceTools was enhanced in v2.75 to support a server/client request for a snapshot of the current session (Get Session). This feature was mentioned in the previous post (http://racetools.com/?p=176) but it is described in more detail here.
Enabling Relay Server
Enabling the Relay Server in RaceTools is very easy. Just go to the main program File menu and select Relay Server. You will be prompted to confirm or change the IP address to listen to (enter 0.0.0.0 to accept connections on any IP address, or a specific IP address if you wish to restrict access to a single IP address on that machine) and port to listen for connections on. This combination is what other clients will connect to. A checkmark beside the option means the Relay Server is active. In this case it will listen for requests on port 9000.
Connecting to Relay Server
Connecting to the Relay Server is the same as connecting to the Pit Lane server. You can either directly specify and connect to the T&S feed using the File menu Connect T&S, or use the Configuration window to specify the T&S Server IP and Port. For the IP address, enter the IP address of the Relay Server. For the Port, use the Listen port specified when you enabled or configured the Relay Server (9000 in this example). Clients connected to the Relay Server will get a copy of whatever the Relay Server receives.
Getting a Snapshot (Get Session)
One big advantage of the Relay Server is that not only can the Relay Server distribute the incoming data feed (thereby reducing network traffic between the pit stand and the T&S server) it can also share whatever data it has already captured for the session. This means that if the Relay Server has been running since the start of the session and a client connects mid-session, it can get a snapshot of everything up to that point and then continue with the live data as if it had been connected the whole time. This feature was added in version 2.75
You don’t have to get the live data feed from the Relay Server for this feature to work. You can still be connected to the pit lane T&S server, but the transition from archive to live data might be a little less smooth, depending on how far you are into the race.
To request a Session Snapshot, use the file menu ‘Get Session’ (CTRL+G) from the main program window. Enter the IP address and port number of the Relay Server.
The current status and log of GetSession requests are displayed in the Announcement line and Message window.
Once the Get Session request is complete, the client will have an exact copy of data that the Relay Server has and will proceed with the live data from the T&S connection.
There is one main caveat to the Get Session function; the Relay Server and clients need to be running compatible versions of RaceTools. Because the data being sent is an exact copy of the in-memory data, any changes in how or what data is logged will make two version incompatible. I will try to limit these changes and note them when necessary, but it means you cannot run v2.77 as the server and v2.79 as the client, or vice versa.
I recommend that you run a copy of RaceTools on the pit stand with the Relay Server enabled at all times (before the first session until the end of the last session) to capture the data. I would minimize the user interaction on this machine to keep it as stable as possible, perhaps using it to display the track map and basic results. This will make sure that there is a copy of the current session available to other copies of RaceTools as needed. Ideally this would be a machine that stays at the pitstand. It doesn’t have to be portable or very powerful. It should have enough storage to log all of the sessions and be kept on all day.
The client RaceTools can connect to the pit lane T&S server or the Relay Server for the live feed, but if you need to start or restart RaceTools after a session has started, you can use the Get Session command to get a snapshot of the current session.