Ejemplo n.º 1
0
        public override void ConnectAsync(IAsyncResult ar)
        {
            try
            {
                mSocket.EndConnect(ar);
                //连接完成开始接收数据

                Client.StartReciveData(mSocket, () => { Client = null; });
            }
            catch (Exception e)
            {
                ConnectErrorEvent?.Invoke();
                ("ConnectAsyncError:" + e).KLog(LogLevel.Err);
            }
        }
Ejemplo n.º 2
0
        void ServerConnectCB(IAsyncResult ar)
        {
            try
            {
                skt.EndConnect(ar);
                session = new T();
                session.StartRcvData(skt, null);



                // 开启心跳线程

                /* Thread server = new Thread(new ThreadStart(SendHeardBeatCB));
                 * server.IsBackground = true;
                 * server.Start();*/
            }
            catch (Exception e)
            {
                ConnectErrorEvent?.Invoke();
                NetLogger.LogMsg(e.Message, LogLevel.Error);
            }
        }