There are currently two controls that utilize the SRP Synchronization Server: the SRP Schedule Control and the SRP DirectConnect Control. As you might have noticed, the SRP Synchronization Server is already at version two. That is because after we developed the SRP Schedule Synchronization Server, which was specific to synchronizing only SRP Schedule Controls, we soon discovered that the server could be made data agnostic. So, we took the original server, improved the networking codebase, and updated it to simply accept and broadcast generic binary data packets. We felt these changes warranted the new version number.
Starting the Server
The very first step in synchronizing any SRP ActiveX Control is to run the SRP Synchronization Server. The easiest way to do this is to double click the application from within Windows Explorer. When the server starts, a small window appears:
This small statistical window is, for the most, meant to assure you that the server is running. There are some minor statistics you can monitor. Although send and receive Errors occasionally occur, this does not usually hinder the synchronization process since the server always makes multiple attempts to send and receive when these errors occur. The window can be hidden by clicking either the Hide button or the red close button in the caption bar.
In addition to the window, an icon will appear in the system tray.
You can always double-click this icon to make the window reappear, or right click it to access a small menu.
Use the menu to toggle the window's visibility or to shut down the server.
Note that the system tray menu is the only way to shut down the server.
If you want to start the server already hidden, use the /S command line parameter:
By default, the SRP Synchronization Server communicates on port 25000. However, you can customize this via the command line. Simply use the /PORT=x command line parameter, where x is the port you want the server to communicate through. For example:
This is useful if you plan to have more than one server. You can have one server per port. In most cases, the default port is sufficient.
Connecting SRP ActiveX Controls
Once the server is running, you can start connecting multiple SRP ActiveX Controls to it. This is accomplished using the control's Server property. You have to know the IP address of the machine running the SRP Synchronization Server and the port on which it is listening. For example, this is how to connect an SRP Schedule Control:
Once a control is connected, the SRP Synchronization Server will automatically notify other controls of any changes made to this one. You don't have to do anything else since the control takes care of the rest. For example, when you make changes to the SRP Schedule Control's Appt property, it automatically sends data to the SRP Synchronization Server on your behalf.
The only time you have to explicitly send data to the SRP Synchronization Server is when you don't have the control handy. See the SRP ActiveX Controls help file for information on how to do this for each control.
Using Different SRP ActiveX Controls
Since the SRP Synchronization Server can support any kind of control, it's best to ensure that different types of controls use separate servers. For example, if you synchronization both SRP Schedule Controls and SRP DirectConnect Controls, it's best to have a separate server for each set. Of course, this means you'll have to start each server on a different port. You could run two servers, one on port 25000 and one on 25001, then make sure that SRP Schedule Controls always connect to the first port and SRP DirectConnect Controls always connect to the second port. While we've made the effort to ensure the two controls will play nicely using the same server, doing so can waste network usage since network passages would be needlessly broadcasted to controls that cannot use them.
Validating Server Connections
Both the SRP Schedule Control and the SRP DirectConnect Control have a property you can use to verify that the control has a valid connection to the SRP Synchronization Server. This property is called ServerValid. It is a read only property that returns 1 if the connection is valid, or 0 if not. Controls' connections are persistent, so this property can let you know immediately if the server is connected. Feel free to check this property often within your application to let your users know when a connection has been lost. Note, however, that the controls always attempt to reconnect to the server when a connection is inadvertently lost.
Note that the controls also offer a way of validating that the server is running without needing to use the control itself. See the SRP ActiveX Controls help file for information on how to do this for each control.