Chapter 26



  • 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


The code downloads for this chapter are found at on the Download Code tab. The code for this chapter is divided into the following major examples:

  • BasicWebClient
  • Browser
  • DnsLookup
  • SocketClient
  • SocketServer
  • TcpSend
  • TcpReceive
  • ViewHeaders
  • WebSocketSample


This chapter takes a fairly practical approach to networking, 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, and why it 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. It covers some of the lower-level means of getting at these protocols through the .NET Framework. You will also find other means ...

Get Professional C# 2012 and .NET 4.5 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.