Skip to Content
The Sockets Networking API: UNIX® Network Programming Volume 1, Third Edition
book

The Sockets Networking API: UNIX® Network Programming Volume 1, Third Edition

by W. Richard Stevens, Bill Fenner, Andrew M. Rudoff
November 2003
Intermediate to advanced
1024 pages
25h 50m
English
Addison-Wesley Professional
Content preview from The Sockets Networking API: UNIX® Network Programming Volume 1, Third Edition

Chapter 16. Nonblocking I/O

Introduction

By default, sockets are blocking. This means that when we issue a socket call that cannot be completed immediately, our process is put to sleep, waiting for the condition to be true. We can divide the socket calls that may block into four categories:

  1. Input operations—These include the read, readv, recv, recvfrom, and recvmsg functions. If we call one of these input functions for a blocking TCP socket (the default), and there is no data available in the socket receive buffer, we are put to sleep until some data arrives. Since TCP is a byte stream, we will be awakened when “some” data arrives: It could be a single byte of data, or it could be a full TCP segment of data. If we want to wait until some fixed ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Network Programming with Go

Network Programming with Go

Adam Woodbeck

Publisher Resources

ISBN: 0131411551Purchase book