LinuxQuestions.org
Help answer threads with 0 replies.
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-22-2006, 03:21 PM   #1
kar_the_terrible
LQ Newbie
 
Registered: Sep 2006
Posts: 4

Rep: Reputation: 0
Event Driven Sockets


Im trying to write code in Linux for event drive socket communication. My preference is to use PF_UNIX sockets, here is a forum post that has some sample code,

<snip-link> uwsg.iu.edu/hypermail/linux/net/9806.0/0189.html <snip-link>

I compiled it as is, but it does not work as expected (read Orig. Poster's comment), in that I only get one SIGIO/SIGPOLL interrupt (I believe those two signal codes are identical), I can only read the first message sent by the client, after which no further SIGIO interrupts occur even though the client keeps sending a message every second.

The following was done:
1) I thought that maybe the client was buffering data till some threshold was reached. But even after explicitly flushing the sock-fd, I did not get an interrupt on the server end.

2) Could the server-side socket be buffering data?

3) Should the SIGIO interrupt handler be associated with the listening socket on the server-side or the socket used in the 'accept' system call?

4) Is there a library out there that you prefer? Other than QT etc. my target app is for an embedded sys with extremely limited resources, so I'd prefer a plain vanilla C/C++ library.

Thanks.
 
Old 09-23-2006, 12:41 PM   #2
Aeiri
Member
 
Registered: Feb 2004
Posts: 307

Rep: Reputation: 30
It's my understanding that a recv() on a socket should "block" (or just sit there) until enough data is received by the socket. So, if you just execute a recv() of 1 after you clear the buffer, it will wait until data is received.
 
Old 09-23-2006, 03:29 PM   #3
kar_the_terrible
LQ Newbie
 
Registered: Sep 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Is that true even if the socket is set as nonblocking? or does that apply to only read() and write() ?
 
Old 09-23-2006, 05:41 PM   #4
Aeiri
Member
 
Registered: Feb 2004
Posts: 307

Rep: Reputation: 30
If the socket is set as nonblocking that isn't true.
 
  


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
Event driven connection allomeen Programming 6 02-28-2006 05:42 AM
Community driven advertisment? Caboose General 4 04-10-2005 07:24 PM
Command-driven interactive C++ program Y0jiMb0 Programming 11 01-13-2004 08:24 AM
Event driven object-to-object: C++ template class mecanism ( NOT STL or STDC++) bretzeltux Programming 2 12-23-2003 03:45 PM

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

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