コード例 #1
0
ファイル: AsyncSocketAcceptor.cs プロジェクト: zesus19/c5.v1
        private void OnSessionDestroyed(Object sender, IoSessionEventArgs e)
        {
            AsyncSocketSession s = e.Session as AsyncSocketSession;

            if (s != null && _readWritePool != null)
            {
                _readWritePool.Push(s.ReadBuffer);
                _readWritePool.Push(s.WriteBuffer);
            }
        }
コード例 #2
0
        private void OnSessionDestroyed(Object sender, IoSessionEventArgs e)
        {
            AsyncSocketSession s = e.Session as AsyncSocketSession;

            if (s != null)
            {
                // clear the buffer and reset its count to original capacity if changed
                s.ReadBuffer.Dispose();
                s.WriteBuffer.Dispose();
            }
        }
コード例 #3
0
        private void OnSessionDestroyed(Object sender, IoSessionEventArgs e)
        {
            AsyncSocketSession s = e.Session as AsyncSocketSession;

            if (s != null && _readWritePool != null)
            {
                // clear the buffer and reset its count to original capacity if changed
                s.ReadBuffer.Clear();
                s.ReadBuffer.SetBuffer();
                _readWritePool.Push(s.ReadBuffer);

                s.WriteBuffer.Clear();
                s.WriteBuffer.SetBuffer();
                _readWritePool.Push(s.WriteBuffer);
            }
        }
コード例 #4
0
        void readWriteEventArg_Completed(object sender, SocketAsyncEventArgs e)
        {
            AsyncSocketSession session = e.UserToken as AsyncSocketSession;

            if (session == null)
            {
                return;
            }

            if (e.LastOperation == SocketAsyncOperation.Receive)
            {
                session.ProcessReceive(e);
            }
            else if (e.LastOperation == SocketAsyncOperation.Send ||
                     e.LastOperation == SocketAsyncOperation.SendPackets)
            {
                session.ProcessSend(e);
            }
            else
            {
                // TODO handle other Socket operations
            }
        }