Added example answer

This commit is contained in:
Dmitry Sovetin
2019-10-16 09:43:52 +03:00
parent 9e1bb7dd7c
commit 6aee2882df
2 changed files with 8 additions and 0 deletions

View File

@@ -17,6 +17,12 @@ func lstn(connection *net.UDPConn, alarm chan struct{}) {
for err == nil {
n, remoteAddr, err = connection.ReadFromUDP(buffer)
fmt.Println("from", remoteAddr, "-", buffer[:n])
n, err = connection.WriteToUDP([]byte("OK"), remoteAddr)
if err != nil {
fmt.Println("WriteUDP Error (", err.Error(), ")")
} else {
fmt.Println("WriteUDP... OK")
}
}
fmt.Println("Listener failed (", err, ")!")