PeerAddr => inet_ntoa(INADDR_BROADCAST),
That makes no sense for UDP. UDP is connectionless, so the socket has no peer.
The first is that the can_read never fires except for timeouts. If I take it out, the recv blocks and never completes.
I don't see why you say that's a problem. can_read should only return if recv won't block, so it appears to be working properly.
The second is that when I set $thread_stop (to kill the thread), Perl crashes when I execute the return.
There are really only two possible replies to that:
- "Oh yeah, exiting a thread always crashes Perl."
- "Odd, that shouldn't happen."
Would you care to guess which one it is? Hint: It's not the first. If you can't debug the crash yourself, perhaps you should give us something we can debug.