Stop() public method

public Stop ( ) : void
return void
Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("=============");
            Console.WriteLine("This is only an example program, meant to be used with the TradeClient example.");
            Console.WriteLine("=============");

            if (args.Length != 1)
            {
                Console.WriteLine("usage: Executor CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            try
            {
                SessionSettings settings = new SessionSettings(args[0]);
                IApplication executorApp = new Executor();
                IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
                ILogFactory logFactory = new FileLogFactory(settings);
                ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(executorApp, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("==FATAL ERROR==");
                Console.WriteLine(e.ToString());
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("usage: SimpleAcceptor CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            try
            {
                SessionSettings settings = new SessionSettings(args[0]);
                Application app = new SimpleAcceptorApp();
                MessageStoreFactory storeFactory = new FileStoreFactory(settings);
                LogFactory logFactory = new FileLogFactory(settings);
                IAcceptor acceptor = new ThreadedSocketAcceptor(app, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("==FATAL ERROR==");
                Console.WriteLine(e.ToString());
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("=============");
            Console.WriteLine("This is for evaluating new QF/n builds and features.");
            Console.WriteLine("It's designed to communicate with PilotInitiator44.");
            Console.WriteLine("=============");

            if (args.Length != 1)
            {
                Console.WriteLine("usage: PilotAcceptorr44 CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            try
            {
                SessionSettings settings = new SessionSettings(args[0]);
                IApplication myApp = new PilotAcc44App();
                IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
                ILogFactory logFactory = new FileLogFactory(settings);
                ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(myApp, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("==FATAL ERROR==");
                Console.WriteLine(e.ToString());
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                System.Console.WriteLine("usage: AcceptanceTest CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            FileLog debugLog = new FileLog("log", new SessionID("AT", "Application", "Debug")); 
            ThreadedSocketAcceptor acceptor = null;
            try
            {
                ATApplication testApp = new ATApplication(debugLog);
                testApp.StopMeEvent += new System.Action(delegate() { _stopMe = true; });
                
                SessionSettings settings = new SessionSettings(args[0]);
                IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
                ILogFactory logFactory = null;
                if (settings.Get().Has("Verbose") && settings.Get().GetBool("Verbose"))
                    logFactory = new FileLogFactory(settings);
                acceptor = new ThreadedSocketAcceptor(testApp, storeFactory, settings, logFactory);

                acceptor.Start();
                while (true)
                {
                    System.Console.WriteLine("o hai "+System.DateTime.Now.ToString());
                    System.Threading.Thread.Sleep(1000);

                    // for tests of logout
                    if (_stopMe)
                    {
                        // this doesn't seem to work
                        // after stop, it doesn't seem to start up again
                        /*
                        acceptor.Stop();
                        Thread.Sleep(5 * 1000);
                        _stopMe = false;
                        acceptor.Start();
                         */
                    }
                }
            }
            catch (System.Exception e)
            {
                debugLog.OnEvent(e.ToString());
            }

            finally
            {
                if(acceptor != null)
                    acceptor.Stop();
            }
            
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            string file = "server.cfg";

            SessionSettings settings = new SessionSettings(file);
            IApplication executorApp = new Server();
            IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
            ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(executorApp, storeFactory, settings);

            acceptor.Start();
            Console.WriteLine("press <enter> to quit");
            Console.Read();
            acceptor.Stop();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            var settingsFile = "FixAtServer.cfg";
            if (args.Length >= 1)
            {
                settingsFile = args[0];
            }

            Console.WriteLine("Starting server ...");
            try
            {
                var settings = new SessionSettings(settingsFile);
                var server = new ServerApplication(Console.WriteLine);
                var storeFactory = new FileStoreFactory(settings);
                var logFactory = new FileLogFactory(settings);
                var acceptor = new ThreadedSocketAcceptor(server,
                                                          storeFactory,
                                                          settings,
                                                          logFactory);

                acceptor.Start();
                Console.WriteLine("Server started");
                Console.WriteLine("Press Ctrl-C to quit");
                // TODO A better stop mechanism!

                // http://stackoverflow.com/questions/177856/how-do-i-trap-ctrl-c-in-a-c-sharp-console-app
                Console.CancelKeyPress += (sender, e) =>
                    {
                        Console.WriteLine("Stopping server ...");
                        acceptor.Stop();
                        server.Stop();
                        Console.WriteLine("Server stopped");
                    };

                while (true)
                {
                    System.Threading.Thread.Sleep(1000);
                }

            }
            catch (Exception e)
            {
                Console.WriteLine("Error: {0}", e);
            }
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Console.WriteLine("=== CharEncoding Acceptor startup");

            try
            {
                SessionSettings settings = new SessionSettings("acceptor.cfg");
                IApplication app = new CEAcceptorApp();
                IMessageStoreFactory storeFactory = new FileStoreFactory(settings);
                ILogFactory logFactory = new FileLogFactory(settings);
                ThreadedSocketAcceptor acceptor = new ThreadedSocketAcceptor(app, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("==FATAL ERROR==");
                Console.WriteLine(e.ToString());
            }
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            Console.WriteLine("=============");
            Console.WriteLine("This is only an example program.");
            Console.WriteLine("It's a simple server (e.g. Acceptor) app that will let clients (e.g. Initiators)");
            Console.WriteLine("connect to it.  It will accept and display any application-level messages that it receives.");
            Console.WriteLine("Connecting clients should set TargetCompID to 'SIMPLE' and SenderCompID to 'CLIENT1' or 'CLIENT2'.");
            Console.WriteLine("Port is 5001.");
            Console.WriteLine("(see simpleacc.cfg for configuration details)");
            Console.WriteLine("=============");

            if (args.Length != 1)
            {
                Console.WriteLine("usage: SimpleAcceptor CONFIG_FILENAME");
                System.Environment.Exit(2);
            }

            try
            {
                SessionSettings settings = new SessionSettings(args[0]);
                Application app = new SimpleAcceptorApp();
                MessageStoreFactory storeFactory = new FileStoreFactory(settings);
                LogFactory logFactory = new FileLogFactory(settings);
                IAcceptor acceptor = new ThreadedSocketAcceptor(app, storeFactory, settings, logFactory);

                acceptor.Start();
                Console.WriteLine("press <enter> to quit");
                Console.Read();
                acceptor.Stop();
            }
            catch (System.Exception e)
            {
                Console.WriteLine("==FATAL ERROR==");
                Console.WriteLine(e.ToString());
            }
        }