LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 06-24-2010, 03:28 PM   #1
jork
LQ Newbie
 
Registered: Jun 2010
Location: beweth
Distribution: Ubuntu, RHEL, Monta Vista, QNX
Posts: 16

Rep: Reputation: 0
select() waking up with rd_set on a not yet connected socket.


I'm facing a strange problem with our code. What the program does is to wait on a select() after a non-blocking connect. And I expect the select wake up with write_set after the ESTAB. And I expect select wakeup with both rd_set and wr_set if I recv a RST back for our SYN or any similar errors. But in one of the cases I'm seeing select is waking up with only rd_set in a non-connected sockeet, which is causing a lot of problems for me.

The code is organized such that the socket close() happens only in wr_set processing. Because of that with the above problem I'm going in to a strange scenario. After the event I call select() again and wait for another socket event. But with this issue, my select is waking up there after everytime as soon as I call select(). That too only with rd_set. So it keeps on going with select() sleeping 0 secs. Thus the program is hung and eating lot of CPU cycles also.

The trigger for all these problems seems to be some event which causes the waking up of select() with rd_set only. I tried many ways to find out what is happening with this. Couldn't find anything interesting yet. Anyhelp on this would be highly appreciated.

Thanks,
jork
 
Old 07-19-2010, 05:22 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Moved: This thread is more suitable in Programing and has been moved accordingly to help your question get the exposure it deserves.
 
  


Reply



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 select() + socket() phsythax Programming 6 06-25-2010 12:33 AM
Socket programming select interface virtualCoder Programming 2 01-16-2010 09:52 PM
in need of a 'select' break with a closed socket ta0kira Programming 6 01-10-2008 04:35 PM
Select() did not select my socket thvo Programming 1 05-08-2005 12:20 AM
Socket and Select() problems strikernzl Programming 2 09-01-2003 08:34 AM

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

All times are GMT -5. The time now is 03:55 AM.

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