I think you're supposed to use accept() and listen() on UDP sockets

also added a check to see if the end of the data packet is less than 512 (according to the rfc)