Writing an asynchronous HTTP server and client
This recipe shows you how to create a simple asynchronous HTTP server.
Getting ready
To step through this recipe, you will need Visual Studio 2015. No other prerequisites are required. The source code for this recipe can be found at BookSamples\Chapter9\Recipe2
.
How to do it...
The following steps demonstrate how to create a simple asynchronous HTTP server:
- Start Visual Studio 2015. Create a new C# console application project.
- Add a reference to the
System.Net.Http
framework library. - In the
Program.cs
file, add the followingusing
directives:using System; using System.IO; using System.Net; using System.Net.Http; using System.Threading.Tasks; using static System.Console;
- Add the following code snippet below ...
Get Multithreading with C# Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.