Beispiel #1
0
            /// <summary>
            /// 连接
            /// </summary>
            /// <param name="ar"></param>
            public static void Connect(IAsyncResult ar)
            {
                UserSock self = (UserSock)ar.AsyncState;

                if (self.m_State == SockState.Idle)
                {
                    LogSystem.Log("Idle");
                    return;
                }
                try
                {
                    self.m_Socket.EndConnect(ar);
                }
                catch (SocketException e)
                {
                    LogSystem.Log("SocketException e");
                    self.SetSockError(e.ErrorCode, e.ToString());
                    self.ConnectFail();
                    return;
                }
                catch (Exception e)
                {
                    LogSystem.Log("Exception e", e.ToString());
                    return;
                }
                self.StopConnect();
            }
Beispiel #2
0
            /// <summary>
            /// 连接
            /// </summary>
            /// <param name="ar"></param>
            public static void Connect(IAsyncResult ar)
            {
                UserSock self = (UserSock)ar.AsyncState;

                if (self.m_State == SockState.Idle)
                {
                    //Log.Trace("Idle");
                    return;
                }
                try
                {
                    self.m_Socket.EndConnect(ar);
                }
                catch (SocketException e)
                {
                    //Log.Trace("SocketException e");
                    self.SetSockError(e.ErrorCode, e.Message);
                    self.ConnectFail();
                    return;
                }
                catch (Exception e)
                {
                    //Log.Trace("Exception e" + e.Message);
                    return;
                }
                self.StopConnect();
            }