LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 09-14-2005, 05:01 AM   #1
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Rep: Reputation: 30
how to make nonblocking FILE *fp?


hiho@ll

i create a socket connection and use fdopen so i can use fgets fputs .... functions

the problem
if do fcntl(); on the socket to make it O_NONBLOCK and then make fopen
fgets it blocks!

is it impossible to do nonblocking operations with fgets? or did i something wrong with my code to set it nonblocking:

fcntl(sv[1],F_SETFL,fcntl(sv[1],F_GETFL)|O_NONBLOCK|O_NDELAY);

or is there a function other than fcntl i have to use to set the FILE *fp to nonblocking?

thx@ll
 
Old 09-14-2005, 05:07 AM   #2
Thinking
Member
 
Registered: Oct 2003
Posts: 249

Original Poster
Rep: Reputation: 30
damn

forget the post
i used the wrong descriptor!

NONBLOCKING works for fgets ... functions
 
  


Reply


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
nonblocking onc rpc jwstric2 Programming 0 02-08-2005 02:37 PM
nonblocking connect jwstric2 Programming 0 12-30-2004 12:00 PM
I accidentally deleted make file in /usr/local/bin, now cannot use make command.... Niceman2005 Linux - Software 2 11-17-2004 07:55 PM
Poll with nonblocking file descriptors bstark Programming 1 11-03-2004 08:27 PM
nonblocking keyboard input? rebelcan Programming 16 10-11-2004 04:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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