Initialize() 공개 메소드

Prepare the stream for single connection reading and writing
public Initialize ( ) : void
리턴 void
예제 #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);
            }
        }