RegisterApplication

Creates the registration for this application and starts the connection. This method is equivalent to calling RegisterApplication(0).

Syntax

public void RegisterApplication()

Parameters

None.

Examples

  • Register an Application – Start registering the application and return at once.
    app.RegisterApplication();
    

Usage

You must set up the ConnectionProperties and ApplicationIdentifier before you can invoke registerApplication.

The maximum length of the Application ID is 64 characters. The total length of the Application Connection ID cannot exceeds 128 characters. For Windows platforms, the Application Connection ID format is: deviceId${_instanceId}__applicationId, if the instanceId is given; otherwise the format is deviceId__applicationId. For Windows Mobile, the Application Connection ID format is deviceId__applicationId. The instanceId separator is a single underscore (_), while the applicationId separator is two underscores.

Application app = Application.GetInstance();

// set Application ID - need to match as the server side Application ID
app.ApplicationIdentifier = "SMP101";
ConnectionProperties props = app.ConnectionProperties;
props.ServerName = "server.mycompany.com";
props.PortNumber = 5001;
LoginCredentials loginCred = new LoginCredentials("supAdmin", "supPwd");
props.LoginCredentials = loginCred;

SMP101DB.SetApplication(app);

if (app.RegistrationStatus != RegistrationStatus.REGISTERED) 
{
// If the application has not been registered to the server,
// register now
app.RegisterApplication();
}