Last active
December 14, 2015 07:59
-
-
Save whyrusleeping/5054299 to your computer and use it in GitHub Desktop.
quick test code to listen for udp packets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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