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. |
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.
|
Is that true even if the socket is set as nonblocking? or does that apply to only read() and write() ?
|
If the socket is set as nonblocking that isn't true.
|
All times are GMT -5. The time now is 12:17 AM. |