Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-09-2008, 03:28 AM   #1
LQ Newbie
Registered: Oct 2008
Posts: 6

Rep: Reputation: 0
Information about open()/read()

Hi guys

I have a problem with the function read() or open(), that some of you might be able to help me with.

I have a Huawei E220 3G modem, which works perfectly. I'm designing a system, that have to access the huawei modem, and read the flowreports it sends back. This also work perfectly (sometimes ).

But heres the kicker:

I currently open the modem like this:


And read like this:


As far as i know, this means that it is opened as read and write, and it has/is no_delay/non_blocking.

When i use read, it does not call the read as blocking call, so it return null, when ever no data is present. I would like it to be a blocking call. This means that I have to remove the non_blocking option on the open function. But this does not make it blocking call. It still returns null values constantly.

I have also tried to make the mode to read only: O_RDONLY. But no results.

Do any of you have some idea that i could try to make it a blocking call, or perhaps an explanation to why it is not a blocking call?

Thanks in advance.

- the fish
Old 10-10-2008, 01:46 PM   #2
LQ Newbie
Registered: May 2008
Posts: 2

Rep: Reputation: 0
For read() a return of 0 indicates an EOF/end of file condition, not a would block condition. Would block on a nonblocking fd is indicated by a return of < 0 with errno set to EAGAIN. I am not sure why you are getting an EOF condition, depends on what you're reading from, but setting to to blocking/non-blocking is not going to change it.


e220, huawei, nonblocking, open, read

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to read group information from repositories jnreddy Linux - Networking 3 10-02-2008 11:23 PM
How to read machine information? ArthurHuang SUSE / openSUSE 3 03-05-2007 01:06 PM
LXer: Libraries facilitate open access to information with open source software LXer Syndicated Linux News 0 01-23-2007 04:54 AM
time taken to read the information present in pipe ujnam Programming 0 10-27-2004 05:19 AM
How do I read disc and space used information on a DVD? opera_sys Linux - Hardware 2 07-19-2004 06:17 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:31 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration