public static void Connect() { //var client = new MiNetRealClient(new IPEndPoint(IPAddress.Loopback, 19132)); var client = new MiNetClient(new IPEndPoint(IPAddress.Parse("192.168.0.2"), 19132)); client.StartServer(); Console.WriteLine("Server started."); Thread.Sleep(2000); Console.WriteLine("Sending ping..."); client.SendUnconnectedPing(); //client.SendUnconnectedPing(); //client.SendUnconnectedPing(); Console.WriteLine("<Enter> to exit!"); Console.ReadLine(); client.StopServer(); }
public static void Connect() { var client = new MiNetClient(new IPEndPoint(Dns.GetHostEntry("test.inpvp.net").AddressList[0], 19132), new IPEndPoint(IPAddress.Any, 0)); //var client = new MiNetClient(new IPEndPoint(IPAddress.Loopback, 19132)); //var client = new MiNetClient(new IPEndPoint(IPAddress.Parse("192.168.0.3"), 19132)); client.StartServer(); Console.WriteLine("Server started."); Thread.Sleep(2000); Console.WriteLine("Sending ping..."); client.SendUnconnectedPing(); //client.SendUnconnectedPing(); //client.SendUnconnectedPing(); Console.WriteLine("<Enter> to exit!"); Console.ReadLine(); client.StopServer(); }
public void EmulateClient() { try { Console.WriteLine("Client {0} connecting...", Name); //var client = new MiNetClient(new IPEndPoint(Dns.GetHostEntry("play.lbsg.net").AddressList[0], 19132), new IPEndPoint(IPAddress.Any, 0)); //var client = new MiNetClient(new IPEndPoint(Dns.GetHostEntry("test.inpvp.net").AddressList[0], 19132), new IPEndPoint(IPAddress.Any, 0)); //var client = new MiNetClient(new IPEndPoint(IPAddress.Parse("188.165.235.161"), 19132), new IPEndPoint(IPAddress.Any, 0)); var client = new MiNetClient(new IPEndPoint(IPAddress.Loopback, 19132), new IPEndPoint(IPAddress.Loopback, 0)); client.Username = Name; client.ClientId = ClientId; client.StartServer(); Console.WriteLine("Client started."); Thread.Sleep(3000); client.SendUnconnectedPing(); Thread.Sleep(2000); //client.LoginSent = true; Stopwatch watch = new Stopwatch(); watch.Start(); if (client.Listener != null) Console.WriteLine("\t\t\t\t\t\tClient {0} moving...", Name); for (int i = 0; i < 10 && Emulator.Running && watch.ElapsedMilliseconds < TimeToRun; i++) { if (client.Listener == null) break; float y = Random.Next(7, 10) + /*24*/ 55; float length = Random.Next(5, 20); double angle = 0.0; const double angleStepsize = 0.05; float heightStepsize = (float) (Random.NextDouble()/5); while (angle < 2*Math.PI && Emulator.Running) { if (client.Listener == null) break; float x = (float) (length*Math.Cos(angle)); float z = (float) (length*Math.Sin(angle)); y += heightStepsize; x += -2562; z += 743; client.CurrentLocation = new PlayerLocation(x, y, z); client.SendMcpeMovePlayer(); Thread.Sleep(Random.Next(150, 450)); angle += angleStepsize; } } if (client.Listener != null) client.SendDisconnectionNotification(); client.StopServer(); } catch (Exception e) { Console.WriteLine(e); } }