C# is a language designed for the modern computing environment, of which the Internet is an important part. A main design criteria for C# was, therefore, to include those features necessary for accessing the Internet. Although earlier languages, such as C and C++, could be used to access the Internet, download files, and obtain resources, the process was not as streamlined as most programmers would like. C# remedies that situation. Using standard features of C# and the .NET Library, it is finally easy to “Internet-enable” your applications.
Support for networking is contained in two namespaces. The first is System.Net. It defines a large number of high-level, easy-to-use classes that support the various types of operations common to the Internet. The second is System.Net.Sockets. This namespace supports sockets, which offer low-level control over networking. For most applications, the classes provided by System.Net are a better choice because of the convenience they offer, and it is the namespace we will be using in this chapter.
Note | Support for ASP.NET-based network applications is found in the System.Web namespace. |