Редактиране

Споделяне чрез


Sockets in .NET

The System.Net.Sockets namespace contains a managed, cross-platform socket networking implementation. All other network-access classes in the System.Net namespace are built on top of this implementation of sockets.

The Socket class is a managed-code version of the socket services provided relying on native interoperability with Linux, macOS, or Windows. In most cases, the Socket class methods simply marshal data into their native 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 SendAsync and ReceiveAsync) wait until the operation completes before returning control to the calling program. In asynchronous mode, these calls return immediately.

See also