> This is an optional bonus section for Chapter 8. It is not required to complete the rest of the book.
- [Working with network resources](#working-with-network-resources)
- [Working with URIs, DNS, and IP addresses](#working-with-uris-dns-and-ip-addresses)
- [Pinging a server](#pinging-a-server)
Sometimes you will need to work with network resources. The most common types in .NET for working with network resources are shown in the following table:
| Namespace | Example type(s) | Description |
|---|---|---|
| `System.Net` | `Dns`, `Uri`, `Cookie`, `WebClient`, `IPAddress` | These are for working with DNS servers, URIs, IP addresses, and so on.
| `System.Net` | `FtpStatusCode`, `FtpWebRequest`, `FtpWebResponse` | These are for working with FTP servers.
| `System.Net` | `HttpStatusCode`, `HttpWebRequest`, `HttpWebResponse` | These are for working with HTTP servers; that is, websites and services. Types from `System.Net.Http` are easier to use.
| `System.Net.Http` | `HttpClient`, `HttpMethod`, `HttpRequestMessage`, `HttpResponseMessage` | These are for working with HTTP servers; that is, websites and services. You will learn how to use these in *Chapter 15, Building and Consuming Web Services*.
| `System.Net.Mail` | `Attachment`, `MailAddress`, `MailMessage`, `SmtpClient` | These are for working with SMTP servers; that is, sending email messages.
| `System.Net.NetworkInformation` | `IPStatus`, `NetworkChange`, `Ping`, `TcpStatistics` | These are for working with low-level network protocols.
## Working with URIs, DNS, and IP addresses
Let's explore some common types for working with network resources:
1. Use your preferred code editor to add a new **Console App** / `console` project named `WorkingWithNetworkResources` to the `Chapter08` solution/workspace.
- In Visual Studio Code, select `WorkingWithNetworkResources` as the active OmniSharp project.
2. In `Program.cs`, delete the existing statements and then import the namespace for working with a network, as shown in the following code:
```cs
using System.Net; // IPHostEntry, Dns, IPAddress
```
3. In `Program.cs`, add statements to prompt the user to enter a website address, and then use the `Uri` type to break it down into its parts, including the scheme (HTTP, FTP, and so on), port number, and host, as shown in the following code:
```cs
Write("Enter a valid web address (or press Enter): ");
string? url = ReadLine();
if (string.IsNullOrWhiteSpace(url)) // if they enter nothing...