Stop() public method

public Stop ( ) : void
return void
Example #1
0
    static int Main(string[] args)
    {
        if (args.Length == 0)
        {
            Console.WriteLine("sockpol [--all | --local | --file policy]");
            Console.WriteLine("\t--all	Allow access to all URI on every port (4502-4534)");
            Console.WriteLine("\t--local	Allow local access on every port (4502-4534)");
            return(1);
        }

        string policy = null;

        switch (args [0])
        {
        case "--all":
            policy = AllPolicy;
            break;

        case "--local":
            policy = LocalPolicy;
            break;

        case "--file":
            if (args.Length < 2)
            {
                Console.WriteLine("Missing policy file name after '--file'.");
                return(2);
            }
            string filename = args [1];
            if (!File.Exists(filename))
            {
                Console.WriteLine("Could not find policy file '{0}'.", filename);
                return(3);
            }
            using (StreamReader sr = new StreamReader(filename)) {
                policy = sr.ReadToEnd();
            }
            break;

        default:
            Console.WriteLine("Unknown option '{0}'.", args [0]);
            return(4);
        }

        SocketPolicyServer server = new SocketPolicyServer(policy);
        int result = server.Start();

        if (result != 0)
        {
            return(result);
        }

        Console.WriteLine("Hit Return to stop the server.");
        Console.ReadLine();
        server.Stop();
        return(0);
    }
Example #2
0
        static void Main(string[] args)
        {
            int serverport     = 14248;
            int policyport     = 8843;
            int maxconnections = 50;

            if (args.Length > 0)
            {
                serverport = int.Parse(args[0]);
            }
            if (args.Length > 1)
            {
                policyport = int.Parse(args[1]);
            }
            if (args.Length > 2)
            {
                maxconnections = int.Parse(args[2]);
            }

            Console.WriteLine("Usage: CrabBattleServer.exe");
            Console.WriteLine("       CrabBattleServer.exe srvport");
            Console.WriteLine("       CrabBattleServer.exe srvport polyport");
            Console.WriteLine("       CrabBattleServer.exe srvport polyport maxplayers\n");
            Console.WriteLine("Example: CrabBattleServer.exe " + serverport + " " + policyport + " " + maxconnections + "\n");

            //Setup the policy server first.
            const string AllPolicy =
                @"<?xml version='1.0'?>" +
                "<cross-domain-policy>" +
                "	<allow-access-from domain='*' to-ports='*' />"+
                "</cross-domain-policy>";

            // start policy server on non root port > 1023
            SocketPolicyServer policyServer = new SocketPolicyServer(AllPolicy, policyport);

            policyServer.Start();

            // start game server on non root port > 1023 and max connections 20
            GameServer gs = new GameServer(serverport, maxconnections);

            gs.StartServer();

            Console.WriteLine("\n Hit 'ESC' to stop service.");
            while (!Console.KeyAvailable || Console.ReadKey().Key != ConsoleKey.Escape)
            {
                Thread.Sleep(500);
            }

            policyServer.Stop();
            gs.StopServer();
        }
Example #3
0
    public static void Main(string[] args)
    {
        SocketPolicyServer server = new SocketPolicyServer (SocketPolicyServer.AllPolicy);
        server.Start();

        Shoot3KillServer shoot_server = new Shoot3KillServer();
        shoot_server.start();

        while (true) {
            IOut.Log("Input:");
            string input = Console.ReadLine();
            if (input == "q") {
                break;
            }
        }

        server.Stop();
        shoot_server.stop();
    }
Example #4
0
        static void Main(string[] args)
        {
            int serverport = 14248;
            int policyport = 8843;
            int maxconnections = 50;

            if (args.Length>0)
            serverport = int.Parse(args[0]);
            if (args.Length>1)
            policyport = int.Parse(args[1]);
            if (args.Length>2)
            maxconnections = int.Parse(args[2]);

            Console.WriteLine("Usage: CrabBattleServer.exe");
            Console.WriteLine("       CrabBattleServer.exe srvport");
            Console.WriteLine("       CrabBattleServer.exe srvport polyport");
            Console.WriteLine("       CrabBattleServer.exe srvport polyport maxplayers\n");
            Console.WriteLine("Example: CrabBattleServer.exe "+serverport+" "+policyport+" "+maxconnections+"\n");

            //Setup the policy server first.
            const string AllPolicy =
                @"<?xml version='1.0'?>"+
                    "<cross-domain-policy>" +
                    "	<allow-access-from domain='*' to-ports='*' />"+
                    "</cross-domain-policy>";

            // start policy server on non root port > 1023
            SocketPolicyServer policyServer = new SocketPolicyServer(AllPolicy, policyport);
            policyServer.Start();

            // start game server on non root port > 1023 and max connections 20
            GameServer gs = new	GameServer(serverport, maxconnections);

            gs.StartServer();

            Console.WriteLine("\n Hit 'ESC' to stop service.");
            while (!Console.KeyAvailable || Console.ReadKey().Key != ConsoleKey.Escape)
                Thread.Sleep(500);

            policyServer.Stop();
            gs.StopServer();
        }
Example #5
0
    static int Main(string[] args)
    {
        if (args.Length == 0) {
            Console.WriteLine ("sockpol [--all | --range | --file policy]");
            Console.WriteLine ("\t--all	Allow access on every port)");
            Console.WriteLine ("\t--range	Allow access on portrange 4500-4550)");
            return 1;
        }

        string policy = null;
        switch (args [0]) {
        case "--all":
            policy = AllPolicy;
            break;
        case "--local":
            policy = LocalPolicy;
            break;
        case "--file":
            if (args.Length < 2) {
                Console.WriteLine ("Missing policy file name after '--file'.");
                return 2;
            }
            string filename = args [1];
            if (!File.Exists (filename)) {
                Console.WriteLine ("Could not find policy file '{0}'.", filename);
                return 3;
            }
            using (StreamReader sr = new StreamReader (filename)) {
                policy = sr.ReadToEnd ();
            }
            break;
        default:
            Console.WriteLine ("Unknown option '{0}'.", args [0]);
            return 4;
        }

        SocketPolicyServer server = new SocketPolicyServer (policy);
        int result = server.Start ();
        if (result != 0)
            return result;

        Console.WriteLine ("Hit Return to stop the server.");
        Console.ReadLine ();
        server.Stop ();
        return 0;
    }