Article View: news.software.nntp
Article #56237Re: How recv() determines the receiving is finished?
From: Russ Allbery
Date: Sun, 27 Jan 2002 21:12
Date: Sun, 27 Jan 2002 21:12
18 lines
1823 bytes
1823 bytes
Russ Allbery <rra@stanford.edu> writes:
> Yes, recv() normally blocks until it gets data. If you don't want that
> behavior, you need to use non-blocking I/O and a select() loop to wait
> for new data.
You don't actually *need* non-blocking I/O, I should add. It's just
easier to think about that way in my opinion. The basic idea is that you
use select to check your file descriptors and wait for something to
happen, and you don't try to read until select says that there's data
waiting.
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Please post questions rather than mailing me directly.
<http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Technical Details
Message-ID:
<yl4rl7zeel.fsf@windlord.stanford.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mailReferences:
<a30rss$f0j$1@mail.cn99.com> <yly9iju1i5.fsf@windlord.stanford.edu> <a31khk$895$1@mail.cn99.com> <ylsn8ro9o0.fsf@windlord.stanford.edu>Show Full Headers
Complete Article Headers
Message-ID: <yl4rl7zeel.fsf@windlord.stanford.edu> Subject: Re: How recv() determines the receiving is finished? Date: Sun, 27 Jan 2002 13:12:50 -0800 From: Russ Allbery <rra@stanford.edu> References: <a30rss$f0j$1@mail.cn99.com> <yly9iju1i5.fsf@windlord.stanford.edu> <a31khk$895$1@mail.cn99.com> <ylsn8ro9o0.fsf@windlord.stanford.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail Newsgroups: news.software.nntp Organization: The Eyrie Lines: 17 NNTP-Posting-Host: windlord.stanford.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.Stanford.EDU 1012165971 4379 171.64.13.23 (27 Jan 2002 21:12:51 GMT) X-Complaints-To: news@news.stanford.edu User-Agent: Gnus/5.090005 (Oort Gnus v0.05) XEmacs/21.4 (Common Lisp, sparc-sun-solaris2.6) Cancel-Lock: sha1:cOl0AcAHe0RPHOVLGUGNQJVptTc=