Herbert wrote regarding '[EE] Receiving broadcast UDP packets' on Tue, Jan 10 at 10:06: > I have a device on my network that sends out broadcast packets (ip > 255.255.255.255). Presumably you know the destination port as well? :) > I pulled out a linux socket programming example from University that > works fine for unicast packets and have been trying to modify it for > broadcast packets. I have it set to the correct port, but it never sees > any of the broadcast packets. Are you sure you've set it to the *correct* port? As far as I know, that's all you need to do. In order to test that, I just wrote a client and server in perl, and the same client works fine with directed UDP data as with broadcasts. That's one of the appeals of UDP... The client's pretty darned complicated. Feel free to use it instead of bashing your head against the C wall. :) If you're on Linux, surely you have perl installed. #!/usr/bin/perl -w use IO::Socket; my $udp = new IO::Socket::INET (LocalPort => 12344, Proto => 'udp', ) or die "$! \n"; my $buffer; while($udp->recv($buffer, 4096)){ print "$buffer\n"; } The server's pretty simple, too, just for the sake of completeness (and because it could be useful while you're testing): #!/usr/bin/perl -w use IO::Socket; my $peer = shift or die "usage: $0 destination_addr\n"; my $udp = new IO::Socket::INET (PeerPort => 12344, Proto => 'udp', PeerAddr => $peer, Broadcast => 1, ) or die "$! \n"; while(<>){ chomp; last unless $_; $udp->write($_); } Setting the broadcast flag to 1 doesn't really affect unicast packets, in case you're wondering about that... Anyway, the client responds to messages sent to 255.255.255.255, the interface's broadcast address, and the target machine's IP. --Danny -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist