Datagram sockets aren't two way. Are you sure you're stuck with UDP? Its not good for 2 way traffic, because to do the opposite of what you just did (sending or recieving) you need to open a new Socket. You also cannot listen on a broadcast socket.
My advise would be to use TCP unless there are multipule things that need to listen to the broadcast. TCP was meant for 2 way confirmed communication, and you will find that your life of network communication will be made much easier.
Also as a matter of style mixing confess and die and ways of checking for success (using an inline or vs assigning and then checking if it's not defined) generally makes the code more difficult to read.