예제 #1
0
        static void Main(string[] args)
        {
            var client = new MyClient("127.0.0.1", 8888, 4096);

            client.Connect();

            Console.WriteLine("Enter a message and press enter...");
            while (true)
            {
                string input = Console.ReadLine();

                if (input == "quit")
                {
                    break;
                }

                Console.WriteLine("<- '{0}'", input);
                using (var packet = new NetPacket())
                {
                    packet.Write(input);
                    client.Send(packet);
                }
            }

            client.Disconnect();

            Console.WriteLine("Disconnected. Press any key to continue...");
            Console.ReadLine();
        }
예제 #2
0
        private static void Main()
        {
            var client = new MyClient("127.0.0.1", 4444, 512);

            client.Connect();

            Console.WriteLine("Enter a message and press enter...");
            int i      = 0;
            var random = new Random();

            try
            {
                while (true)
                {
                    string input = /*Console.ReadLine();*/ $"{GenerateRandomString(random.Next(50))} - {i.ToString()}";

                    if (input == "quit")
                    {
                        break;
                    }

                    if (input != null)
                    {
                        using (var packet = new NetPacket())
                        {
                            packet.Write(input);

                            //Console.WriteLine($"Sending input: '{input}' ; packet length: '{packet.Buffer.Length}'");
                            client.Send(packet);
                        }
                    }

                    i++;
                    Thread.Sleep(50);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }

            client.Disconnect();

            Console.WriteLine("Disconnected. Press any key to continue...");
            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            var client = new MyClient("127.0.0.1", 8888, 4096);

            client.Connect();

            Console.WriteLine("Enter a message and press enter...");
            int i = 0;

            try
            {
                while (true)
                {
                    string input = Console.ReadLine(); //"Yolo " + i.ToString();

                    if (input == "quit")
                    {
                        break;
                    }

                    if (input != null)
                    {
                        using (var packet = new NetPacket())
                        {
                            packet.Write(input);

                            client.Send(packet);
                        }
                    }

                    i++;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }

            client.Disconnect();

            Console.WriteLine("Disconnected. Press any key to continue...");
            Console.ReadLine();
        }