Beispiel #1
0
 private void Connect()
 {
     // Open the connection - only when the connection is not already opened
     // Opening the connection can fail and raises an exception
     try
     {
         if (protocol.State == ChannelState.Closed)
         {
             protocol.BeginOpen(); // attempt to open the channel asynchronously
         }
     }
     catch (Exception ex)
     {
         Console.Write(ex.Message + "\n" + ex.StackTrace + "\n");
     }
 }
Beispiel #2
0
        private void InitializePSDKProtocolAndAppBlocks()
        {
            MessageBox.Show("sip");
            try
            {
                #region ADDP settings
                PropertyConfiguration config = new PropertyConfiguration();
                config.UseAddp           = true;
                config.AddpServerTimeout = 30;
                config.AddpClientTimeout = 60;
                //config.AddpTrace = "both";
                config.AddpTraceMode = AddpTraceMode.Both;
                #endregion

                Endpoint endpoint = new Endpoint(HOST, PORT, config);
                //Endpoint backupEndpoint = new Endpoint(BACKUP_HOST, BACKUP_PORT, config);

                protocol            = new TServerProtocol(endpoint);
                protocol.ClientName = CLIENT_NAME;
                protocol.BeginOpen();

                Register();
                //Connect();
                //logging();
                //AnswerCall();

                #region Setup Warmstandby
                // WarmStandbyConfiguration warmStandbyConfig = new WarmStandbyConfiguration(endpoint, backupEndpoint);
                //warmStandbyConfig.Timeout = 5000;
                //warmStandbyConfig.Attempts = 2;

                //warmStandbyService = new WarmStandbyService(protocol);
                // warmStandbyService.ApplyConfiguration(warmStandbyConfig);
                //warmStandbyService.Start();
                #endregion

                //protocol.Opened += new EventHandler(OnProtocolOpened);
                //protocol.Closed += new EventHandler(OnProtocolClosed);

                protocol.Received += new EventHandler(OnMessageReceived);
                protocol.Error    += new EventHandler(OnProtocolError);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.ToString());
            }
        }