Working with Network Resources
Explore how to work with network resources in C# using .NET types such as Uri, DNS, and IPAddress. Learn to extract parts of a URL, resolve IP addresses, and ping servers to verify connectivity. This lesson helps you understand practical methods for network programming in console applications.
We'll cover the following...
Sometimes, we 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 |
|
| These are for working with DNS servers, URIs, IP addresses, and so on. |
|
| These are for working with FTP servers. |
|
| These are for working with HTTP servers; that is, websites and services. Types from System.Net.Http are easier to use. |
|
| These are for working with HTTP servers; that is, websites and services. |
|
| These are for working with SMTP servers; that is, sending email messages. |
|
| 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:
Step 1: Use your preferred code editor to add a new Console App or console project named ...