O'Reilly logo

Network Programming with Rust by Abhishek Chanda

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Socket multiplexing in tokio

One model of asynchronous-request processing in a server is through multiplexing incoming connections. In this case, each connection is assigned a unique ID of some kind and replies are issued whenever one is ready, irrespective of the order in which it was received. Thus, this allows a higher throughput, as the shortest job gets the highest priority implicitly. This model also makes the server highly responsive with a larger number of incoming requests of varying complexity. Traditional Unix-like systems support this using the select and poll system calls for socket multiplexing.

In the tokio ecosystem, this is mirrored by a number of traits that enable implementing multiplexed protocols. The basic anatomy of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required