共用方式為


Sockets

The System.Net.Sockets namespace contains a managed implementation of the Windows Sockets interface. All other network-access classes in the System.Net namespace are built on top of this implementation of sockets.

The .NET Framework Socket class is a managed-code version of the socket services provided by the Winsock32 API. In most cases, the Socket class methods simply marshal data into their native Win32 counterparts and handle any necessary security checks.

The Socket class supports two basic modes, synchronous and asynchronous. In synchronous mode, calls to functions that perform network operations (such as Send and Receive) wait until the operation completes before returning control to the calling program. In asynchronous mode, these calls return immediately.

See Also

Tasks

How to: Create a Socket

Concepts

TCP/UDP
Using Application Protocols