Using System.Net

The using statement might be one of the most important statements you can include in source files containing any sort of networking code. The System.Net namespace is a suite of general-purpose .NET Core classes and utilities for programming most protocols and networked system behaviors. It is the root namespace for the most common networking classes you'll use as we move through this book.

The namespace includes classes for the following:

  • Domain name resolution and DNS access
  • The abstract base WebRequest and WebResponse classes, as well as common implementations of those classes, including FtpWebRequest, and HttpWebRequest
  • Internet Protocol (IP) resolution and definition
  • Socket utility class definitions
  • Many others

The classes in this namespace will be your bread and butter as you begin to develop more complex and powerful software, and you should spend a fair amount of time familiarizing yourself with the features and functionality the System.Net namespace encapsulates.