Chapter 24. Networking


  • Downloading files from the Web

  • Using the WebBrowser control in a Windows Forms application

  • Manipulating IP addresses and performing DNS lookups

  • Socket programming with TCP, UDP, and socket classes

This chapter takes a fairly practical approach, mixing examples with a discussion of the relevant theory and networking concepts as appropriate. This chapter is not a guide to computer networking but an introduction to using the .NET Framework for network communication.

You will learn how to use the WebBrowser control in a Windows Forms environment. You will also learn how the WebBrowser control can make some specific Internet access tasks easier to accomplish. However, the chapter starts with the simplest case, sending a request to a server and storing the information sent back in the response.

This chapter covers facilities provided through the .NET base classes for using various network protocols, particularly HTTP and TCP, to access networks and the Internet as a client. We cover some of the lower-level means of getting at these protocols through the .NET Framework. You will also find other means of communicating via these items using technologies, such as the Windows Communication Foundation (WCF), covered in Chapter 43.

The two namespaces of most interest for networking are System.Net and System.Net.Sockets. The System.Net namespace is generally concerned with higher-level operations, for example, downloading and uploading files, and making ...

Get Professional C# 4 and .NET 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.