Пример #1
0
 public NetState()
 {
     _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     _recvBuffer = new BufferPool("Receive Buffer", 16, 4096);
     _messagePump = new MessagePump();
     _buffer = new ByteQueue();
 }
Пример #2
0
 public NetState()
 {
     _socket      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     _recvBuffer  = new BufferPool("Receive Buffer", 16, 4096);
     _messagePump = new MessagePump();
     _buffer      = new ByteQueue();
 }
Пример #3
0
        public void Dispose()
        {
            if (_socket == null || _isDisposing)
            {
                return;
            }

            _isDisposing = true;

            try
            {
                _socket.Shutdown(SocketShutdown.Both);
            }
            catch (SocketException ex)
            {
                Tracer.Error(ex);
            }

            try
            {
                _socket.Close();
            }
            catch (SocketException ex)
            {
                Tracer.Error(ex);
            }

            _socket = null;
            _buffer = null;
        }
Пример #4
0
        public void Dispose()
        {
            if (_socket == null || _isDisposing)
                return;

            _isDisposing = true;

            try
            {
                _socket.Shutdown(SocketShutdown.Both);
            }
            catch (SocketException ex)
            {
                Tracer.Error(ex);
            }

            try
            {
                _socket.Close();
            }
            catch (SocketException ex)
            {
                Tracer.Error(ex);
            }

            _socket = null;
            _buffer = null;
        }