Ejemplo n.º 1
0
        public static void Process(ClientSocket clientSocket, MsgDH packet)
        {
            var b = packet.GetPayload();

            clientSocket.Diffie.HandleResponse(Encoding.ASCII.GetString(b));
            clientSocket.Crypto = new Crypto(clientSocket.Diffie.Key);
            clientSocket.Send(MsgLogin.Create("asd", "asdasd", false, MsgLoginType.Login));
        }
Ejemplo n.º 2
0
        public static async Task Main()
        {
            FConsole.WriteLine("Host: ");
            ServerHostname       = Console.ReadLine().Trim();
            Client.OnConnected  += Connected;
            Client.OnPacket     += PacketRouter.Handle;
            Client.OnDisconnect += Disconnected;
            Client.ConnectAsync(ServerHostname, ServerPort);

            while (true)
            {
                var msg = Console.ReadLine();

                switch (msg)
                {
                case "login":
                    Client.Send(MsgLogin.Create("asd", "asdasd", true, MsgLoginType.Login));
                    break;

                case "ping":
                    var array  = new byte[MsgBench.MAX_ARRAY_LENGTH];
                    var random = new Random();
                    for (var i = 0; i < array.Length; i++)
                    {
                        array[i] = (byte)random.Next(0, 255);
                    }
                    Stopwatch.Start();
                    for (var i = 0; i < 1000; i++)
                    {
                        var msgBench = MsgBench.Create(array, false);
                        Client.Send(msgBench);
                    }
                    break;

                case "send":
                    var user = (User)Client.StateObject;
                    FConsole.WriteLine("Requesting Token...");
                    user.Send(MsgToken.Create("transcoder", 0, true));
                    while (!user.Tokens.ContainsKey(0))
                    {
                        Thread.Sleep(1);
                    }
                    FConsole.WriteLine("Uploading... using " + user.Tokens[0]);
                    Stopwatch.Start();
                    await user.SendFile(@"/home/alumni/transcoder", 0);

                    Stopwatch.Stop();
                    FConsole.WriteLine($"Done. {Stopwatch.Elapsed.TotalSeconds.ToString("##.##")}");
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public static async Task Main()
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, a) =>
            {
                Debugger.Break();
            };
            Console.Title = "CLIENT APP";
            LoadConfig();

            if (await Client.ConnectAsync(SERVER_IP, SERVER_PORT))
            {
                Client.Send(MsgLogin.Create("user", "pass"));
            }

            while (true)
            {
                Console.ReadLine();
            }
        }
Ejemplo n.º 4
0
 public void Setup()
 {
     CachedMsg   = MsgLogin.Create("user", "pass", true, Universal.Packets.Enums.MsgLoginType.Login);
     CachedArray = CachedMsg;
 }
Ejemplo n.º 5
0
 private void Connected()
 {
     FConsole.WriteLine("Connected!");
     Core.Client.Send(MsgLogin.Create(User, Pass, "", true, MsgLoginType.Login));
 }