473,242 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

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 5839
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Samuel | last post by:
I wrote a very simple httpmodule and tried to compile it with no success. This is my code: ============== Imports System Imports System.Web Imports Microsoft.VisualBasic NameSpace...
3
by: darkstorm | last post by:
I have a doubt regarding inheritance involving templates Consider this: ///////////////////////////////////// template<typename T> class A { private: T m_a;
10
by: Florian G. Pflug | last post by:
Hi I installed a postgres-application (which was developed on debian woody) on red hat 9 today, using the postgres 7.3 rpms from redhad. One of my the triggers uses the pg_settings table (more...
77
by: M.B | last post by:
Guys, Need some of your opinion on an oft beaten track We have an option of using "goto" in C language, but most testbooks (even K&R) advice against use of it. My personal experience was that...
8
by: AG | last post by:
Hello, This is my first post to this group, and on top of that I am a beginner. So please direct me to another group if this post seems out of place.... I have recently written a program which...
42
by: mellyshum123 | last post by:
I need to read in a comma separated file, and for this I was going to use fgets. I was reading about it at http://www.cplusplus.com/ref/ and I noticed that the document said: "Reads characters...
4
by: Andu | last post by:
First off, i apologize for the badly named thread... I tried to edit the name, but for some reason the new name won't update... Ok, so i'm new to python.. but i've undertaken a project in...
10
by: somenath | last post by:
Hi All, I was trying to write a function which will read one line from a specified file and return the line. It is currently working fine. But it would be very much helpful for me if some one...
4
by: mpatharkar | last post by:
Hi all, I wrote a script to search a pattern in input file and if pattern does not found in input file ,print that pattern in to output file. The input file is...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.