Beginning Microsoft® Visual C#® 2008
by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, Eric White
Chapter 32. Networking
Chapter 21 dealt with a high-level technology to communicate across the network: Web Services. You learned how to send messages from the client to the server in a platform-independent way with the SOAP and .NET-specific protocols. In this chapter, you step into lower networking layers, programming with classes from the namespace System.Net. Web Services itself uses this technology.
This chapter begins with an overview of programming client and server applications with classes from the namespaces System.Net and System.Net.Sockets, which make use of protocols such as HTTP, TCP, and UDP. You explore both connection-oriented applications with TCP and connectionless applications with the UDP protocol.
This chapter includes the following topics:
An overview of networking
Networking programming options
Using
WebRequestTcpListenerandTcpClientSocket programming
Networking Overview
Networking is about communicating with applications on other systems. The communication happens by sending messages. Messages can be sent to a single system where a connection is initiated before the message, as shown in Figure 32-1, or messages can be sent to multiple systems by a broadcast, as shown in Figure 32-2. With a broadcast, connections are not initiated; the messages are just sent to the network instead.

Figure 32.1. Figure 32-1
Figure 32.2. Figure 32-2
Networking can be best illustrated ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access