pnyx/cmd/client/main.go

30 lines
461 B
Go

package main
import (
"net"
"os"
"time"
)
func main() {
address, err := net.ResolveUDPAddr("udp", os.Args[1])
if err != nil {
panic(err)
}
connection, err := net.DialUDP("udp", nil, address)
if err != nil {
panic(err)
}
for true {
written, err := connection.Write([]byte(os.Args[2]))
if written != len(os.Args[2]) {
panic(written)
} else if err != nil {
panic(err)
}
time.Sleep(time.Second)
}
}