add some more checks and connect in udp sending