func writeToFile(p *osc.OscPacket) { file, err := os.Create("message1.bin") if err != nil { panic(err) } defer file.Close() data := p.SerializeTCP() file.Write(data) }
func sendAsUDP(p *osc.OscPacket) { addr, _ := net.ResolveUDPAddr("udp", "localhost:10001") conn, err := net.DialUDP("udp", nil, addr) if err != nil { panic(err) } defer conn.Close() data := p.SerializeUDP() _, err = conn.Write(data) if err != nil { panic(err) } }