public static void init() { Login = new Portal(100); Chat = new Portal(101); PColl = new PortalCollection(); PColl.RegisterPortal(Login); PColl.RegisterPortal(Chat); }
public static void init() { Login = new Portal(100); Chat = new Portal(101); PColl = new PortalCollection(); PColl.RegisterPortal(Login); PColl.RegisterPortal(Chat); }
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(); }
static void Main(string[] args) { //Client initalisieren Portal system = new Portal(100); PortalCollection PC = new PortalCollection(); PC.RegisterPortal(system); system.IncomingPacket += OnSystemPacket; Thread.Sleep(1000); //while (online) //{ int counter = 0; while (true) { while (Livinglist.Count < 500) { lock (Livinglist_lock) { counter++; Vaser.ConnectionSettings.VaserKerberosClient k = new Vaser.ConnectionSettings.VaserKerberosClient(); Link lnk1 = VaserClient.ConnectClient("localhost", 3100, PC, k); lnk1.Disconnecting += OnDisconnectingLink; lnk1.AttachedID = (uint)counter; if (lnk1 != null) { //Console.WriteLine("1: successfully established connection."); Livinglist.Add(lnk1); } } lock (Livinglist_lock) { counter++; Vaser.ConnectionSettings.VaserKerberosClient k = new Vaser.ConnectionSettings.VaserKerberosClient(); Link lnk2 = VaserClient.ConnectClient("localhost", 3101, PC, k); lnk2.Disconnecting += OnDisconnectingLink; lnk2.AttachedID = (uint)counter; if (lnk2 != null) { //Console.WriteLine("2: successfully established connection."); Livinglist.Add(lnk2); } } Thread.Sleep(50); } Thread.Sleep(1000); } //Thread.Sleep(1); //Console.ReadKey(); //} }
public void FailConnection() { Portal system = new Portal(100); PortalCollection PColl = new PortalCollection(); PColl.RegisterPortal(system); Link lnkC = VaserClient.ConnectClient("localhost", 3110, PColl); }
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"); }
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; } } }
static void Threads(object Context) { //Client initalisieren Portal system = new Portal(100); PortalCollection PC = new PortalCollection(); PC.RegisterPortal(system); system.IncomingPacket += OnSystemPacket; Thread.Sleep(1000); //while (online) //{ int counter = 0; lock (Livinglist_lock) { counter++; Vaser.ConnectionSettings.VaserKerberosClient k = new Vaser.ConnectionSettings.VaserKerberosClient(); Link lnk1 = VaserClient.ConnectClient("wswinprev", 3500, PC, k); lnk1.Disconnecting += OnDisconnectingLink; lnk1.AttachedID = (uint)counter; if (lnk1 != null) { Console.WriteLine("1: successfully established connection."); Livinglist.Add(lnk1); } } Thread.CurrentThread.Abort(); }
public void InitPortals() { testC = new Portal(100); PCollC = new PortalCollection(); PCollC.RegisterPortal(testC); }
static void Main(string[] args) { bool online = true; //Client initalisieren Portal system = new Portal(100); PortalCollection PC = new PortalCollection(); PC.RegisterPortal(system); system.IncomingPacket += OnSystemPacket; TestRequest myRequest = new TestRequest(); PC.RegisterRequest(myRequest, system, 501); TestChannel myChannel = new TestChannel(); PC.RegisterChannel(myChannel, system, 502); // ########################################################### // 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! // ########################################################### /*//Import Test Cert from local store * X509Certificate2Collection cCollection = new X509Certificate2Collection(); * * 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 * { * cCollection.Add(certificates[0]); * } * // Get the value. * string resultsTrue = cCollection[0].ToString(true); * // Display the value to the console. * Console.WriteLine(resultsTrue); * // Get the value. * string resultsFalse = cCollection[0].ToString(false); * // Display the value to the console. * Console.WriteLine(resultsFalse);*/ /*System.Timers.Timer _aTimer = new System.Timers.Timer(1); * _aTimer.Elapsed += DoPackets; * _aTimer.AutoReset = true; * _aTimer.Enabled = true;*/ Thread.Sleep(100); VaserSSLClient ssl = new VaserSSLClient("localhost"); VaserKerberosClient kerberos = new VaserKerberosClient(); Link lnk1 = VaserClient.ConnectClient("localhost", 3100, PC); lnk1.EmptyBuffer += OnEmptyBuffer; if (lnk1 != null) { Console.WriteLine("1: successfully established connection."); } //working if (lnk1.IsConnected) { Console.WriteLine("Test. Con OK"); } cStatus sts = myRequest.myRequestStarter("HELLO WORLD!", lnk1); myChannel.mySendStarter("This is my channel tester", lnk1); while (online) { if (sts != null) { if (sts.Done && !sts.Error) { Console.WriteLine("Request Done Result: " + (string)sts.ResultObject); sts = null; online = false; } if (sts != null && sts.Error) { Console.WriteLine("Error: " + sts.Message); sts = null; online = false; } } Thread.Sleep(1000); //entfernen //if (lnk1.IsConnected == false) online = false; } //Client1.CloseClient(); lnk1.Dispose(); Console.WriteLine("Test ended... press any key..."); Console.ReadKey(); }
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(); }
public void InitPortals() { testS = new Portal(100); PCollS = new PortalCollection(); PCollS.RegisterPortal(testS); }
public static void start() { try { bool online = true; Thread.Sleep(1000); system = new Portal(100); PColl = new PortalCollection(); PColl.RegisterPortal(system); system.IncomingPacket += OnSystemPacket; while (online) { while (Livinglist.Count < 10) { Link lnk1 = VaserClient.ConnectClient("localhost", 3100, PColl); lnk1.Disconnecting += OnDisconnectingLink; Link lnk2 = VaserClient.ConnectClient("localhost", 3101, PColl); lnk2.Disconnecting += OnDisconnectingLink; if (lnk1 != null) { //Console.WriteLine("1: successfully established connection."); lock (Livinglist_lock) { Livinglist.Add(lnk1); } } else { throw new Exception("Connerror!"); } if (lnk2 != null) { //Console.WriteLine("2: successfully established connection."); lock (Livinglist_lock) { Livinglist.Add(lnk2); } } else { throw new Exception("Connerror!"); } } Thread.Sleep(1); if (counter > 1000) { LongTimeTest.stop = true; break; } } } catch (Exception e) { lock (LongTimeTest.threadlock) { LongTimeTest.error = true; LongTimeTest.stop = true; } } }
public static void Run() { bool online = true; //Client initalisieren Portal 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! // ########################################################### /*//Import Test Cert from local store * X509Certificate2Collection cCollection = new X509Certificate2Collection(); * * 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 * { * cCollection.Add(certificates[0]); * } * // Get the value. * string resultsTrue = cCollection[0].ToString(true); * // Display the value to the console. * Console.WriteLine(resultsTrue); * // Get the value. * string resultsFalse = cCollection[0].ToString(false); * // Display the value to the console. * Console.WriteLine(resultsFalse);*/ /*System.Timers.Timer _aTimer = new System.Timers.Timer(1); * _aTimer.Elapsed += DoPackets; * _aTimer.AutoReset = true; * _aTimer.Enabled = true;*/ Thread.Sleep(100); VaserSSLClient ssl = new VaserSSLClient("localhost"); VaserKerberosClient kerberos = new VaserKerberosClient(); Link lnk1 = VaserClient.ConnectClient("localhost", 3100, PC); lnk1.EmptyBuffer += OnEmptyBuffer; if (lnk1 != null) { Console.WriteLine("1: successfully established connection."); } //working if (lnk1.IsConnected) { Console.WriteLine("Test. Con OK"); } while (online) { Thread.Sleep(100); //entfernen if (lnk1.IsConnected == false) { online = false; } } //Client1.CloseClient(); lnk1.Dispose(); Console.WriteLine("Test ended... press any key..."); Console.ReadKey(); }