LinuxQuestions.org
Help answer threads with 0 replies.
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 09-29-2010, 05:53 AM   #1
manjub
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Rep: Reputation: 0
poll() system call not returning when the socket is closed locally


we have a multi threaded program on Linux where one thread is waiting on poll() system call with event set to POLLIN, & another thread has closed the same socket fd (which is passed to poll) , but the poll() did not return, is this the expected behavior?

From man page of poll we found that the poll should return POLLNVAL if the socket fd is closed, is my understanding correct or is there any bug in the poll()?

In Solaris we observed that the poll system call is returning with POLLNVAL if the socket is closed.
 
Old 09-29-2010, 07:25 AM   #2
srinathduraisamy
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Rep: Reputation: 4
Hi,

Normally, if socket fd passed for poll is closed, then poll should return positive value for the socket's EOF.
 
Old 09-29-2010, 10:28 PM   #3
manjub
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Original Poster
Rep: Reputation: 0
yes we are also expecting an positive value to be returned from poll(), But it is not exiting only!!!
Is this poll() bug free in all versions of LINUX??
We are using 2.6.18-194.el5 kernel release.
 
Old 09-30-2010, 12:37 AM   #4
srinathduraisamy
LQ Newbie
 
Registered: Nov 2009
Posts: 9

Rep: Reputation: 4
If what every you mentioned was your requirement. You can use select system call instead of poll.

Most people will suggest select over poll.
 
  


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
Poll() and UDP socket krizzz Programming 4 06-06-2006 10:55 AM
poll system call in kernel space xatzipol Programming 0 10-16-2005 07:03 AM
why oh why was my poll closed??????????????????????? t3gah LQ Suggestions & Feedback 21 06-13-2005 04:51 AM
how to use poll() for socket lordofring Linux - Networking 3 02-08-2005 09:08 AM
IPC in socket using select system call Gomathy Linux - Networking 0 01-28-2005 06:37 AM

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

All times are GMT -5. The time now is 07:35 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