in reply to How to answer a UDP broadcast

A couple of notes:

$socket->peername makes no sense when using UPD. UPD sockets aren't connected, so they don't have a peer. The address of the sender is packet-specific, which is why recv returns it. $socket->peername should be replaced with $ip.

Proto => 'udp' and Type => SOCK_DGRAM are redundant. They both mean the same thing. Either one will do. Currently, one of them is silently being ignored.

Replies are listed 'Best First'.
Re^2: How to answer a UDP broadcast
by mje (Curate) on Jun 19, 2007 at 21:04 UTC
    Point 1 taken - this was a result of experimentation and not the original code. Redundant does not make wrong but perhaps the other poster has hit the nail on the head in that you cannot listen on a broadcast udp socket - that was the info I was after.