UDP stuff

I think I transferred all the socket and connection stuff over
correctly. Not tested, though.