Prevent hang with zero length socket commands

For some reason, isValid() returns true even when a socket has been
disconnected - insert tweaks to work around this and avoid an infinite
loop when a null command is sent to an existing displaz instance.