Summary

Nonblocking I/O is a double-edged sword. On the one hand, it makes it possible to write servers that can process multiple simultaneous connections without spawning new processes or threads. Compared to the multiprocessing solutions, nonblocking I/O has a slight performance edge and consumes fewer system resources. Nonblocking I/O is also the only viable solution for creating multiconnection servers that will run on platforms that do not support the fork() or thread APIs, such as the Macintosh.

On the other hand, nonblocking I/O significantly increases the complexity of networking software. Most of this complexity comes from the overhead of keeping track of partial writes and handling EWOULDBLOCK errors from syswrite() and sysread()

Get Network Programming with Perl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.