Beispiel #1
0
        public override void Connect()
        {
            if (m_InConnecting)
            {
                throw new Exception("The socket is connecting, cannot connect again!");
            }

            if (Client != null)
            {
                throw new Exception("The socket is connected, you neednt' connect again!");
            }

            //If there is a proxy set, connect the proxy server by proxy connector
            m_InConnecting = true;

//WindowsPhone doesn't have this property
#if SILVERLIGHT && !WINDOWS_PHONE
            RemoteEndPoint.ConnectAsync(ClientAccessPolicyProtocol, ProcessConnect, null);
#else
            //采用Begin-End模式实现
            RemoteEndPoint.MyConnectAsync(MyProcessConnect, null);
#endif
        }