select on udp recvfrom doesn't work ???

Dave Cramer davec-zxk95TxsVYDyHADnj0MGvQC/G2K4zDHf at public.gmane.org
Wed Aug 11 17:22:08 UTC 2010


Len,

> How about this little example.  It waits for a UDP message (anything at
> all) on port 5000, and when that happens it starts to print a message
> every 10 ticks, with a tick rate of 10ms, (so 10 times per second it
> does the print).
>
> I start it by doing:
>
> echo "Foo" | nc -u ipaddress 5000 -q 1
>
> nc is netcat.  Any other udp capable network connection should work too.
>

Thanks for taking the time to write this, couple questions:

1) sock = socket(AF_INET, SOCK_DGRAM, 0); this seems to be a common
mistake. it should be socket(BF_INET....) happens that AF_INET and
BF_INET both = 2

Where does it do the read ? or does it block on the bind ?

> --
> Len Sorensen
>
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list