A tiny channel wrapper around UDP connections
It's pretty simple: call Connect
or Listen
and get a []byte
channel back!
inbound, err := Listen(":9999", nil)
if err != nil {
// handle err
}
outbound, err := Connect(":9999")
if err != nil {
// handle err
}
message := []byte("foo")
// Send a message over UDP
outbound <- message
// Receive a message over UDP
read := <-inbound // = []byte("foo")
MIT