package main import ( "encoding/gob" "fmt" "log" "net" "os" "mcquay.me/robo" ) func main() { ln, err := net.Listen("tcp", fmt.Sprintf(":%d", robo.Port)) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } log.Println("locked and loaded") for { var err error conn, err := ln.Accept() if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } dec := gob.NewDecoder(conn) for { point := robo.Point{} err = dec.Decode(&point) if err != nil { break } log.Printf("%+v", point) } if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) } log.Printf("disconnect: %+v\n", conn) } }