I am trying to create a two way street between two computers using UDP as the protocol. Maybe I do not understand the point of net.ListenUDP. Isn't that a blocking call? Waiting for a client connection?
addr := net.UDPAddr{ Port: 2000, IP: net.ParseIP("127.0.0.1"), } conn, err := net.ListenUDP("udp", &addr) // code does not block here defer conn.Close() if err != nil { panic(err) } var testPayload []byte = []byte("This is a test") conn.Write(testPayload)
go udp
Jonathan eustace
source share