in reply to UDP-Broadcast with socket

Both your programs call recv but who supposed to send?

Update: Ops, ikegami is right, it's server code twice. BTW, there's no need to set SO_BROADCAST on receiving side, it should be set on sender.