For example, if host =:= undefined, it just encode record with some atom undefined, the encode returns ok, and it's result can not transfer to binary or send with udp port. I think it should return error, or just encode "undefined" to some string but not an atom.