Code Comments
Programming Forum and web based access to our favorite programming groups.I wrote a program that created a UDP socket (SOCKET_DGRAM) with the expectation of reading UDP datagrams from it but select() claims that the socket was never ready for reading. Now, I _know_ there was data to be read because replacing the select() call with a synchronous recvfrom() call returns data! So, what's up? Why doesn't select() work connectionless sockets? Is this the same on all UNIX systems? I'm trying this on Linux 2.4.21. Thanks...
Post Follow-up to this message"Just Another Victim of the Ambient Morality" <ihatespam@rogers.com> writes: > I wrote a program that created a UDP socket (SOCKET_DGRAM) with the > expectation of reading UDP datagrams from it but select() claims that the > socket was never ready for reading. Now, I _know_ there was data to be re ad > because replacing the select() call with a synchronous recvfrom() call > returns data! > > So, what's up? Why doesn't select() work connectionless sockets? Is > this the same on all UNIX systems? I'm trying this on Linux 2.4.21. It has always worked for me on all Unixes I've tried. Post some code demonstrating the problem. -- Måns Rullgård mru@mru.ath.cx
Post Follow-up to this message"Just Another Victim of the Ambient Morality" <ihatespam@rogers.com> wrote in message news: <zKS1d.257$RTE1.109@news01.bloor.is.net.cable.rogers.com>... > I wrote a program that created a UDP socket (SOCKET_DGRAM) with the > expectation of reading UDP datagrams from it but select() claims that the > socket was never ready for reading. Now, I _know_ there was data to be re ad > because replacing the select() call with a synchronous recvfrom() call > returns data! > > So, what's up? Why doesn't select() work connectionless sockets? Is > this the same on all UNIX systems? I'm trying this on Linux 2.4.21. > Thanks... The select() system call works just fine with UDP on linux. Trust me, its not the kernel. Its your code. The number one select() mistake that everyone makes at one time or another is incorrectly setting the first agument - the maximum fd *plus one*. Check that first. dv
Post Follow-up to this messagedv is right. I've also posted a message to talk about this, and I realized that in my implementation, I did put *1* in the first arguement on the select(). If you can take a look at the man page, you will figure out more. =) - tikviva dirtyvicar@hotmail.com (Dirty Vicar) wrote in message news:<b90dfd06.0409160810.4f56546e@po sting.google.com>... > "Just Another Victim of the Ambient Morality" <ihatespam@rogers.com> wrote in message news:<zKS1d.257$RTE1.109@news01.bloor.is.net.cable.rogers.com>.. . > > The select() system call works just fine with UDP on linux. Trust me, > its not the kernel. Its your code. > > The number one select() mistake that everyone makes at one time or > another is incorrectly setting the first agument - the maximum fd > *plus one*. Check that first. > > dv
Post Follow-up to this message"Dirty Vicar" <dirtyvicar@hotmail.com> wrote in message news:b90dfd06.0409160810.4f56546e@posting.google.com... > "Just Another Victim of the Ambient Morality" <ihatespam@rogers.com> wrote in message news:<zKS1d.257$RTE1.109@news01.bloor.is.net.cable.rogers.com>... the read Is > > The select() system call works just fine with UDP on linux. Trust me, > its not the kernel. Its your code. > > The number one select() mistake that everyone makes at one time or > another is incorrectly setting the first agument - the maximum fd > *plus one*. Check that first. Ah, it turns out that that was, indeed, my problem. Thanks for the help! I've got another question but I'll ask that in its own thread...
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.