Пример #1
0
        private bool Connect()
        {
            if (null == _strVoiceServerHostname)
            {
                _strVoiceServerHostname = "localhost";
            }
            if (!m_voipclient.Connect(_strVoiceServerHostname, _iVoiceServerPort, kiUDPPort, 0, 0))
            {
                logDebugOnly(String.Format("Failed to connect to voice server"));
            }

            //wait until we get connected.
            int  tries     = 0;
            int  maxTries  = 20;
            bool isRunning = false;

            while (!isRunning && tries < maxTries)
            {
                Thread.Sleep(100);
                isRunning = m_voipclient.IsConnected();
            }
            if (isRunning)
            {
                logDebugOnly("Connection to Conaito server succeeded\n");
                // wait for OnConnectSuccess or OnConnectFailed event
                updateButtonStates();
                return(true);
            }
            else
            {
                logDebugOnly("Connection to Conaito server failed\n");
                return(false);
            }
        }
Пример #2
0
 private bool Disconnect()
 {
     if (voipclient.IsConnected() || voipclient.IsConnecting())
     {
         return(voipclient.Disconnect());
     }
     else
     {
         return(false);
     }
 }
Пример #3
0
        private bool Connect()
        {
            if (null == _strVoiceServerHostname)
            {
                _strVoiceServerHostname = "localhost";
            }
            if (!m_voipclient.Connect(_strVoiceServerHostname, _iVoiceServerPort, kiUDPPort, 0, 0))
            {
                //logDebugOnly(String.Format("Failed to connect to voice server"));
            }

            //wait until we get connected.
            int  tries     = 0;
            int  maxTries  = 20;
            bool isRunning = false;

            while (!isRunning && tries < maxTries)
            {
                Thread.Sleep(100);
                isRunning = m_voipclient.IsConnected();
            }
            return(isRunning);
        }