/// <summary>
 /// 设置SocketAsyncEventArgs缓存区
 /// </summary>
 /// <param name="arg">SocketAsyncEventArgs对象</param>
 /// <exception cref="OutOfMemoryException"></exception>
 public static void SetBuffer(SocketAsyncEventArgs arg)
 {
     lock (BufferSetter.syncRoot)
     {
         while (BufferSetter.linkedList.Last.Value.SetBuffer(arg) == false)
         {
             BufferSetter.CreateBufferBlock();
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 表示会话对象
        /// </summary>
        /// <exception cref="OutOfMemoryException"></exception>
        public TcpSession()
        {
            this.sendArg.Completed += this.SendCompleted;
            this.recvArg.Completed += this.RecvCompleted;

            this.Tag        = new Tag();
            this.RecvBuffer = new ReceiveBuffer();

            BufferSetter.SetBuffer(this.sendArg);
            BufferSetter.SetBuffer(this.recvArg);
        }
 /// <summary>
 /// 设置SocketAsyncEventArgs缓冲区
 /// </summary>
 static BufferSetter()
 {
     BufferSetter.CreateBufferBlock();
 }