updated isValid() method
changed back to udp socket instead of raw socket