Fix warnings of -Wall -Wextra

Also make handling of recvfrom() result less "casty".