Beispiel #1
0
        static void Main(string[] args)
        {
            //Client initalisieren
            system = new Portal(100);
            PortalCollection PC = new PortalCollection();

            PC.RegisterPortal(system);

            system.IncomingPacket += OnSystemPacket;
            Vaser.ConnectionSettings.VaserKerberosServer k = new Vaser.ConnectionSettings.VaserKerberosServer();
            //start the server
            VaserServer Server1 = new VaserServer(System.Net.IPAddress.Any, 3100, PC, k);
            VaserServer Server2 = new VaserServer(System.Net.IPAddress.Any, 3101, PC, k);

            Server1.NewLink += OnNewLinkServer1;
            Server2.NewLink += OnNewLinkServer2;

            Server1.DisconnectingLink += OnDisconnectingLinkServer1;
            Server2.DisconnectingLink += OnDisconnectingLinkServer2;

            Server1.Start();
            Server2.Start();
            t = new Timer(TimerCallback, null, 10000, 10000);
            //TestContainer con2 = new TestContainer();



            //run the server
            Console.ReadKey();
            t.Dispose();
            //close the server
            Server1.Stop();
            Server2.Stop();
        }
Beispiel #2
0
        public static void Start()
        {
            Debug.WriteLine("Starting Server");

            vSystem = new Portal(1);
            vSystem.IncomingPacket += OnSystemPacket;

            CPoll = new PortalCollection();
            CPoll.RegisterPortal(vSystem);

            Server = new VaserServer(System.Net.IPAddress.Any, 4500, CPoll);

            Debug.WriteLine("Starting Done");
        }
Beispiel #3
0
        public static void Stop()
        {
            if (ChatServer != null)
            {
                Console.WriteLine("VaserChat Server is closing...");

                //Teardown
                myPool = new IDPool(10000);
                Client.ClientList.Clear();

                //close the server
                ChatServer.Stop();

                ChatServer = null;
            }
        }
Beispiel #4
0
        public static void Stop()
        {
            if (ChatServer != null)
            {
                Console.WriteLine("VaserChat Server is closing...");

                //Teardown
                myPool = new IDPool(10000);
                Client.ClientList.Clear();

                //close the server
                ChatServer.Stop();

                ChatServer = null;
            }
        }
Beispiel #5
0
        public static void Start()
        {
            Console.WriteLine("VaserChat Server is starting...");

            //initialize the server
            OPTIONS.init();

            OPTIONS.Login.IncomingPacket += OnLoginPacket;
            OPTIONS.Chat.IncomingPacket += OnChatPacket;

            //start the server
            ChatServer = new VaserServer(System.Net.IPAddress.Any, 3100, OPTIONS.PColl);
            ChatServer.NewLink += OnNewLink;
            ChatServer.DisconnectingLink += OnDisconnectingLink;
            ChatServer.Start();

            Console.WriteLine("VaserChat Server has started.");
        }
Beispiel #6
0
        public static void Start()
        {
            Console.WriteLine("VaserChat Server is starting...");

            //initialize the server
            OPTIONS.init();

            OPTIONS.Login.IncomingPacket += OnLoginPacket;
            OPTIONS.Chat.IncomingPacket  += OnChatPacket;

            //start the server
            ChatServer                    = new VaserServer(System.Net.IPAddress.Any, 3100, OPTIONS.PColl);
            ChatServer.NewLink           += OnNewLink;
            ChatServer.DisconnectingLink += OnDisconnectingLink;
            ChatServer.Start();

            Console.WriteLine("VaserChat Server has started.");
        }
Beispiel #7
0
        public static void start()
        {
            try
            {
                //initialize the server
                system = new Portal(100);
                PColl  = new PortalCollection();
                PColl.RegisterPortal(system);

                system.IncomingPacket += OnSystemPacket;

                //start the server
                VaserServer Server1 = new VaserServer(System.Net.IPAddress.Any, 3100, PColl);
                VaserServer Server2 = new VaserServer(System.Net.IPAddress.Any, 3101, PColl);

                Server1.NewLink += OnNewLinkServer1;
                Server2.NewLink += OnNewLinkServer2;

                Server1.DisconnectingLink += OnDisconnectingLinkServer1;
                Server2.DisconnectingLink += OnDisconnectingLinkServer2;

                Server1.Start();
                Server2.Start();

                //run the server
                while (!LongTimeTest.stop)
                {
                    Thread.Sleep(1000);
                }

                //close the server
                Server1.Stop();
                Server2.Stop();
            }
            catch
            {
                lock (LongTimeTest.threadlock)
                {
                    LongTimeTest.error = true;
                    LongTimeTest.stop  = true;
                }
            }
        }
Beispiel #8
0
        public static void Run()
        {
            Console.WriteLine("Welcome to the Vaser testengine");
            Console.WriteLine("Prepareing server");
            Console.WriteLine("");

            Console.WriteLine("Creating container: TestContainer");


            //create connection managing lists



            //initialize the server
            Console.WriteLine("Creating portal: system");
            system = new Portal(100);
            PortalCollection PC = new PortalCollection();

            PC.RegisterPortal(system);

            system.IncomingPacket += OnSystemPacket;



            // ###########################################################
            // Create a TestCert in CMD: makecert -sr LocalMachine -ss root -r -n "CN=localhost" -sky exchange -sk 123456
            // Do not use in Production | do not use localhost -> use your machinename!
            // ###########################################################



            /*Console.WriteLine("Import Test Cert");
             * //Import Test Cert
             * X509Certificate2 cert = new X509Certificate2();
             *
             * X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
             * store.Open(OpenFlags.ReadOnly);
             * var certificates = store.Certificates.Find(X509FindType.FindBySubjectDistinguishedName, "CN=localhost", false);
             * store.Close();
             *
             * if (certificates.Count == 0)
             * {
             *  Console.WriteLine("Server certificate not found");
             *  Console.ReadKey();
             *  return;
             * }
             * else
             * {
             *  Console.WriteLine("Test Cert was found");
             * }
             *
             * // Get the value.
             * string resultsTrue = cert.ToString(true);
             * // Display the value to the console.
             * Console.WriteLine(resultsTrue);
             * // Get the value.
             * string resultsFalse = cert.ToString(false);
             * // Display the value to the console.
             * Console.WriteLine(resultsFalse);
             */
            //start the server
            Console.WriteLine("Creating server: IPAddress any, Port 3100, VaserMode ModeSSL");
            //VaserSSLServer ssl = new VaserSSLServer(certificates[0]);
            VaserKerberosServer kerberos = new VaserKerberosServer();
            VaserServer         Server1  = new VaserServer(System.Net.IPAddress.Any, 3100, PC);

            Server1.NewLink           += OnNewLink;
            Server1.DisconnectingLink += OnDisconnectingLink;
            Server1.Start();

            Console.WriteLine("");


            bool online = true;

            //working
            while (online)
            {
                switch (testmode)
                {
                case 0:
                    Console.WriteLine("Test 1: Connection and Transfer statistics:");
                    Console.WriteLine("Waiting for Connection...");
                    testmode = 1;
                    break;

                case 4:
                    test1.Dispose();
                    Console.WriteLine("Closed");
                    testmode = -1;
                    break;
                }


                if (testmode == -1)
                {
                    break;
                }
                //Time tick
                Thread.Sleep(1);
            }

            //close Server
            Console.WriteLine("Close Server");
            Server1.Stop();



            Console.WriteLine("Test ended. Press any key...");
            Console.ReadKey();
        }
Beispiel #9
0
 public void InitServer()
 {
     RunningServer = new VaserServer(System.Net.IPAddress.Any, Port, PCollS);
 }