Summary


 
Network Programming with Perl
By Lincoln  D.  Stein
Slots : 1
Table of Contents
Chapter  13.   Nonblocking I/O

    Content

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 () calls. The example programs presented in this chapter are among the longest in this book and took a significant amount of time to develop and debug. In my own development efforts, I almost always prefer multiprocessing or thread-based solutions to nonblocking I/O.

Nonblocking I/O can also be used to avoid blocking during calls to connect() and accept() . These techniques allow you to implement timeouts on these calls and to parallelize connection attempts without incurring a substantial increase in the size or complexity of your software.


   
Top


Network Programming with Perl
Network Programming with Perl
ISBN: 0201615711
EAN: 2147483647
Year: 2000
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net