Project Description
Nito.Async is a collection of classes to assist asynchronous programming in .NET, particularly the development and use of classes adhering to the event-based as

Note: If you're looking for Nito.AsyncEx (a library for working with the Async CTP and Tasks), that is a separate project on CodePlex.

Included Classes

Nito.Async includes:
Nito.Async.Sockets Future

The current Nito.Async.Sockets API has been frozen. A new (v2) API will be developed that provides better separation between protocol components (e.g., type of message framing, keepalive system, etc., will all be orthogonal). The new API may be based on the Rx framework, but is more likely to be tied into the .NET 4.0 Task Parallel Library.

Nito.Async.Sockets v1 Classes
More on Nito.Async.Sockets v1

One major problem faced by newcomers to TCP/IP is thread synchronization. It can be difficult to learn networking concepts and multithreading at the same time.

The ClientTcpSocket and ServerTcpSocket classes provide simple thread synchronization by exposing an event-based API for TCP/IP sockets.

There are two other common problems that are discovered when designing a TCP/IP protocol:
  1. Non-packetized data. Most people read about how TCP/IP uses packets, and they believe that message boundaries are preserved. Local-machine testing confirms this misunderstanding. However, TCP/IP sockets deal with a stream of bytes, not messages.
  2. Detection of dropped connections. Again, people read about TCP/IP's keepalive packets, but don't realize that they are pretty much useless.

The SimpleClientTcpSocket and SimpleServerTcpSocket solve these problems by defining a protocol with message boundaries and automatic keepalive messages.

For more information on TCP/IP socket handling in .NET, see the TCP/IP .NET Sockets FAQ.