Compartir a través de


MSDN Magazine on Winsock/System.Net

MSDN Magazine for August 2005 has an article about System.Net.Sockets and WinSock by Daryn Kiely:

Sockets are the transport
mechanism most frequently used in high-performance
server applications. Fortunately, the Win32® Windows®
Sockets library (Winsock) provides mechanisms to improve
the performance of programs that use sockets, and the
Microsoft® .NET Framework
provides a layer over Winsock so that managed
applications can communicate over sockets. So much advanced
socket support is great, but using all these layers to
write a truly high-performance socket-based application
requires a little background information.

I am going to write a trivial chat server app to
explore methods for writing a socket-based server and
client using the base System.Net.Sockets.Socket class.
Although .NET provides higher-level abstractions like
the TcpListener and TcpClient classes (also in
System.Net.Sockets), these classes are missing some of
the advanced features exposed by the lower-level Socket
class. That said, they can be useful in many situations.
The TcpListener class provides simple methods that
listen for and accept incoming connection requests in
blocking synchronous mode, while the TcpClient class
provides simple methods for connecting, sending, and
receiving stream data over a network in synchronous
blocking mode.

   -- Ari Pernick (arip)