Example #1
0
func (server *UDPServer) Unpack(data []byte, addr *net.UDPAddr) {
	if len(data) != 0 {
		Type := data[9]
		switch int8(Type) {
		case protocol.AUDIO:
			audio := protocol.AudioMsg{}
			err := audio.Decode(data[:])
			if err != nil {
				fmt.Printf("UDPServer Unpack Error:%v", err.Error())
				return
			}
			server.Audio(&audio, addr)
		default:
		}
	}
}