Beispiel #1
0
 internal void CommitBuffer(IBuffer buffer)
 {
     try
     {
         Buffers.Buffer bf = (Buffers.Buffer)buffer;
         bf.UserToken = this;
         bf.BindIOEvent(IO_Completed);
         ((Buffers.Buffer)buffer).AsyncTo(this.Socket);
     }
     catch (Exception e_)
     {
         Buffers.Buffer.Free(buffer);
         DisConnect();
         ProcessError(e_, "session send data error!");
     }
 }
Beispiel #2
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!");
         }
     }
 }