Created
November 6, 2017 19:51
-
-
Save matipan/814e96bdd0a174cbef3b95d4e6729068 to your computer and use it in GitHub Desktop.
This file contains 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 ( | |
"context" | |
"fmt" | |
"net" | |
"os" | |
"github.com/matipan/qsy" | |
) | |
func main() { | |
group := net.IPv4(224, 0, 0, 12) | |
srv, err := qsy.NewServer(context.TODO(), "en0", group, os.Getenv("MY_IP")) | |
if err != nil { | |
panic(err) | |
} | |
srv.ListenAndAccept() | |
for { | |
select { | |
case pkt := <-srv.Incoming(): | |
fmt.Printf("got packet from %v\n", pkt.ID) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment