示例#1
0
 /// <summary>
 /// Receive data asynchronously
 /// </summary>
 public void BeginReceive()
 {
     try
     {
         AsyncCallback cb = new AsyncCallback((ar) => {
             if (isConnected)
             {
                 int len = _socket.EndReceive(ar);
                 _extractor.Extract(len);
                 BeginReceive();
             }
         });
         _socket.BeginReceive(_extractor.readBytes, _extractor.readCount, _extractor.remainCount, SocketFlags.None, cb, null);
     }
     catch (SocketException e) { ProcessNetworkAnomaly(e.ErrorCode, e.Message); }
 }
 /// <summary>
 /// Receive data asynchronously
 /// </summary>
 public void BeginReceive()
 {
     try
     {
         AsyncCallback cb = new AsyncCallback((ar) =>
         {
             if (isConnected)
             {
                 int len = _socket.EndReceive(ar);
                 _extractor.Extract(len);
                 BeginReceive();
             }
         });
         _socket.BeginReceive(_extractor.readBytes, _extractor.readCount, _extractor.remainCount, SocketFlags.None, cb, null);
     }
     catch (SocketException e)
     {
         OnNetworkAnomaly(e.ErrorCode, e.Message);
         HoxisDirector.Ins.AffairEntry(C.AFFAIR_NETWORK_ANOMALY, new Ret(LogLevel.Error, 1, e.Message));
     }
 }