...

/

Working with Network Resources

Working with Network Resources

Learn about common .NET types for working with network resources, IP addresses, and how to use these types.

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

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.

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:

Step 1: Use your preferred code editor to add a new Console App or console project named WorkingWithNetworkResources to the Chapter08 solution or workspace: ...