Ejemplo n.º 1
0
        private static void SyncRPC(string url)
        {
            ConsoleColor color  = ConsoleColor.DarkMagenta;
            RemoteClient client = new RemoteClient();

            ColorConsole.WriteLine("SyncRPC -> string html = client.GetBodyAsync(url, \"SyncRPC.\").Result;", color);
            string html = client.GetBodyAsync(url, "SyncRPC.", color).Result;

            ColorConsole.WriteLine("SyncRPC -> end", color);
            ColorConsole.WriteLine("SyncRPC -> body = ", color);
            ColorConsole.WriteLine(Limit(html, "SyncRPC"), color);
        }
Ejemplo n.º 2
0
        private static async Task AsyncRPC2(string url)
        {
            ConsoleColor color  = ConsoleColor.Cyan;
            RemoteClient client = new RemoteClient();

            ColorConsole.WriteLine("AsyncRPC2 -> var task = await client.GetBodyAsync(url);", color);
            var task = await client.GetBodyAsync(url, "AsyncRPC2", color);

            ColorConsole.WriteLine("AsyncRPC2 -> WasteTime.Waste(2000);", color);
            WasteTime.Waste(2000);
            ColorConsole.WriteLine("AsyncRPC2 -> string html = task;", color);
            string html = task;

            ColorConsole.WriteLine("AsyncRPC2 -> end", color);
            ColorConsole.WriteLine("AsyncRPC2 -> body = ", color);
            ColorConsole.WriteLine(Limit(html, "AsyncRPC2"), color);
        }
Ejemplo n.º 3
0
        private static async void AsyncRPC1(string url)
        {
            ConsoleColor color  = ConsoleColor.DarkYellow;
            RemoteClient client = new RemoteClient();

            ColorConsole.WriteLine("AsyncRPC1 -> var task = client.GetBodyAsync(url);", color);
            var task = client.GetBodyAsync(url, "AsyncRPC1", color);

            ColorConsole.WriteLine("AsyncRPC1 -> WasteTime.Waste(2000);", color);
            WasteTime.Waste(2000);
            ColorConsole.WriteLine("AsyncRPC1 -> string html = await task;", color);
            string html = await task;

            ColorConsole.WriteLine("AsyncRPC1 -> Task.WaitAll(task);", color);
            Task.WaitAll(task);
            ColorConsole.WriteLine("AsyncRPC1 -> end", color);
            ColorConsole.WriteLine("AsyncRPC1 -> body = ", color);
            ColorConsole.WriteLine(Limit(html, "AsyncRPC1"), color);
        }