Add some bounds checking.
The length returned from sendto() should be uint to be consistent with recvfrom().