The Application instance contains the information and authentication credentials needed to register and connect to the Unwired Server.
// Initialize Application settings Application app = Application.GetInstance(); // The identifier has to match the application ID deployed to the Unwired Server app.ApplicationIdentifier = "SMP101"; // ConnectionProperties has the information needed to register // and connect to Unwired Server ConnectionProperties connProps = app.ConnectionProperties; connProps.ServerName = "server.mycompany.com"; // if you are using relay server, then use the correct port number for the relay server // if connecting using http without a relay server, use the messaging administration port, by default 5001. // if connecting using https without a relay server, then use a new port for https, for example 9001. connProps.PortNumber = 5001; // if connecting using https, set the network protocol connProps.NetworkProtocol = "https"; // Set FarmId and UrlSuffix when connecting through the Relay Server. // Provide user credentials LoginCredentials loginCred = new LoginCredentials("supAdmin", "supPwd"); connProps.LoginCredentials = loginCred; // Initialize generated package database class with this Application instance SMP101DB.SetApplication(app);
If you are using a Relay Server, specify the connection as follows:
// specify Relay Server Host connProps.ServerName = "relayserver.mycompany.com"; // specify Relay Server Port (port 80 by default) connProps.PortNumber = 80; // specify the Relay Server MBS Farm, for example MBS_Farm connProps.FarmId = "MBS_FARM";
Optionally, you can specify the Relay Server URL suffix.