Close() public method

Close the stream
public Close ( ) : void
return void
Ejemplo n.º 1
0
        /// <summary>
        /// Begin the main automation loop, accepting connections and executing commands
        /// </summary>
        public virtual void BeginAutomation()
        {
            try
            {
                _communicator = new TcpServerCommunicator(TCP_PORT);
                MobileDb.Instance.Register(DeviceInfo);

                while (true)
                {
                    _communicator.Initialize();
                    MobileDb.Instance.SetAvailibility(DeviceInfo, false);
                    // Returns when the connection has been closed
                    HandleConnection();
                    MobileDb.Instance.SetAvailibility(DeviceInfo, true);
                }
            }
            catch (ThreadAbortException)
            {
                // App is shutting down, clean up
                _communicator.Close();
                MobileDb.Instance.SetAvailibility(DeviceInfo, false);
            }
        }