Skip to content

Instantly share code, notes, and snippets.

@whyrusleeping
Last active December 14, 2015 07:59
Show Gist options
  • Save whyrusleeping/5054299 to your computer and use it in GitHub Desktop.
Save whyrusleeping/5054299 to your computer and use it in GitHub Desktop.
quick test code to listen for udp packets
package main
import (
"net"
"fmt"
)
func main() {
addr, _ := net.ResolveUDPAddr("udp",":9000")
ucon, _ := net.ListenUDP("udp",addr)
buf := make([]byte, 1)
for {
ucon.Read(buf)
fmt.Println(buf)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment