예제 #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!");
         }
     }
 }