Disconnect() public method

public Disconnect ( ) : void
return void
Exemplo n.º 1
0
        private void ShutDownThread()
        {
            byte counter = 0;

            _rsProtoBuf.FinishQueue();
            // wait 10 seconds to send all remaining items
            while (_rsProtoBuf.ThreadRunning && counter < 10 * 2)
            {
                System.Diagnostics.Debug.WriteLineIf(DEBUG, "waiting to send remaining items - " + counter);
                Thread.Sleep(500);
                counter++;
            }
            _rsProtoBuf.StopThread();
            Thread.Sleep(100);
            if (!_useProperDisconnect)
            {
                _rsProtoBuf.BreakConnection();
            }
            _rsProtoBuf = null;
            _rsConnector.Disconnect();
            _rsConnector   = null;
            _connected     = false;
            _disconnecting = false;
        }