468,476 Members | 1,985 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,476 developers. It's quick & easy.

Regarding EAGAIN error in read()


Hi,

I need to trap EAGAIN error while using read().

I read in some website that read() has to wait till write() is
completed for EAGAIN to occur. But read() doesnt seem to wait, it reads
whatever it can and stores it in the buffer and sets the rest of the
buffer to NULL.

Thanks,
Madhukar

Aug 1 '06 #1
3 5634
In article <11*********************@m73g2000cwd.googlegroups. com>,
Madhu <k.********@gmail.comwrote:
>I need to trap EAGAIN error while using read().
Try asking in comp.unix.programmer . The C language itself does not
have read() or EAGAIN: they are extensions beyond the standard.

>I read in some website that read() has to wait till write() is
completed for EAGAIN to occur.
Don't trust that website.
>But read() doesnt seem to wait, it reads
whatever it can and stores it in the buffer and sets the rest of the
buffer to NULL.
Don't trust that test.
--
"No one has the right to destroy another person's belief by
demanding empirical evidence." -- Ann Landers
Aug 1 '06 #2
I've never heard of the behaviour you mention.
The standard behavior for read is to read anything
available in the stream and return.

If there is no data available, then if read is reading
from a blocking descriptor it will block. If read is
reading from a non blocking descriptor then it will
return with an EAGAIN or EWOULDBLOCK
error.

Also, read and write are not in standard C, so
maybe in another newsgroup you'll get a better
answer than mine.

Papastefanos Serafeim

"Madhu" <k.********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
>
Hi,

I need to trap EAGAIN error while using read().

I read in some website that read() has to wait till write() is
completed for EAGAIN to occur. But read() doesnt seem to wait, it reads
whatever it can and stores it in the buffer and sets the rest of the
buffer to NULL.

Thanks,
Madhukar

Aug 1 '06 #3
"Papastefanos Serafeim" <se******@otenet.grwrites:
I've never heard of the behaviour you mention.
The standard behavior for read is to read anything
available in the stream and return.

If there is no data available, then if read is reading
from a blocking descriptor it will block. If read is
reading from a non blocking descriptor then it will
return with an EAGAIN or EWOULDBLOCK
error.

Also, read and write are not in standard C, so
maybe in another newsgroup you'll get a better
answer than mine.
Please don't top-post. See <http://www.caliburn.nl/topposting.html>.

Please don't offer detailed answers to off-topic questions. The
experts on this stuff hang out in comp.unix.programmer. If you make a
mistake in your answer here (we all make mistakes), we're not going to
be able to correct it If we do, it will likely lead to a lengthy
off-topic discussion that should have been in comp.unix.programmer in
the first place.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Aug 1 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Samuel | last post: by
3 posts views Thread by darkstorm | last post: by
77 posts views Thread by M.B | last post: by
42 posts views Thread by mellyshum123 | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.