Пример #1
0
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)
}
Пример #2
0
func sendAsTCP(p *osc.OscPacket) {
	addr, _ := net.ResolveTCPAddr("tcp", "localhost:10002")
	conn, err := net.DialTCP("tcp", nil, addr)

	if err != nil {
		panic(err)
	}

	defer conn.Close()

	data := p.SerializeTCP()
	_, err = conn.Write(data)

	if err != nil {
		panic(err)
	}
}