示例#1
0
 private void BeginReceive()
 {
     if (IsConnected)
     {
         Buffers.Buffer buffer = (Buffers.Buffer)ReceiveBufferPool.Pop();
         buffer.UserToken = this;
         try
         {
             buffer.AsyncFrom(mReceiveEventArgs, mSocket);
         }
         catch (Exception e_)
         {
             buffer.Free();
             DisConnect();
             ProcessError(e_, "client begin network receive error!");
         }
     }
 }
示例#2
0
文件: Clients.cs 项目: Grart/BeetleX
 public void BeginReceive()
 {
     if (IsConnected && System.Threading.Interlocked.Exchange(ref mReceiveState, 1) == 0)
     {
         Buffers.Buffer buffer = (Buffers.Buffer)BufferPool.Pop();
         buffer.UserToken = this;
         try
         {
             buffer.AsyncFrom(mReceiveEventArgs, mSocket);/// see ref=<see cref="SocketAsyncEventArgs.Completed"/>
         }
         catch (Exception e_)
         {
             InitReceiveState();
             buffer.Free();
             DisConnect();
             ProcessError(e_, "client begin network receive error!");
         }
     }
 }
示例#3
0
 private void BeginReceive()
 {
     if (IsConnected)
     {
         Buffers.Buffer buffer = (Buffers.Buffer)BufferPool.ReceiveDefault.Pop();
         if (!buffer.BindIOCompleted)
         {
             buffer.BindIOEvent(IO_Completed);
         }
         buffer.UserToken = this;
         try
         {
             buffer.AsyncFrom(mSocket);
         }
         catch (Exception e_)
         {
             buffer.Free();
             DisConnect();
             ProcessError(e_, "client begin network receive error!");
         }
     }
 }