Working with Sockets

The Windows operating system has long included a Windows Sockets (Winsock) interface for developers to make network connections using TCP/IP or UDP/IP. The System.Net.Sockets namespace provides a managed implementation of Winsock for the .NET Framework.

TCP is a connection-oriented protocol, so to make a connection there must be a socket listening for incoming TCP requests on the target system. On the client system, you then create a socket to make an outgoing request. The System.Net.Sockets namespace includes the TcpListener and the TcpClient classes, which contain simple methods to perform this kind of transaction. These classes send and receive data in a blocking synchronous mode. To perform asynchronous communications, ...

Get Microsoft® .NET Compact Framework (Core Reference) 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.