Hundemeier / go-sacn

Implementation of the sACN aka ANSI E1.31 protocol for streaming DMX-data in go
MIT License
16 stars 9 forks source link

Transmitter Not Working on other Universes #10

Closed localleon closed 5 years ago

localleon commented 6 years ago

Apparently there is a problem where the transmitter does not transmit packets on universes other than universe 1. I used the latest Version on go version go1.10.1 linux/amd64 .

How to Reproduce

  1. First start a Receiver on your host.
    
    package main

import ( "fmt" "log"

    "github.com/Hundemeier/go-sacn/sacn"

)

func main() { recv, err := sacn.NewReceiverSocket("", nil) if err != nil { log.Fatal(err) } recv.SetOnChangeCallback(func(old sacn.DataPacket, newD sacn.DataPacket) { fmt.Println("data changed on", newD.Universe()) }) recv.SetTimeoutCallback(func(univ uint16) { fmt.Println("timeout on", univ) }) recv.Start() fmt.Println("Started") select {} //only that our program does not exit. Exit with Ctrl+C }

This should print out every sACN Packet it receives. 

2. Run the Transmitter 

package main

import ( "log" "time"

    "github.com/Hundemeier/go-sacn/sacn"

)

func main() { //instead of "" you could provide an ip-address that the socket should bind to trans, err := sacn.NewTransmitter("", [16]byte{1, 2, 3}, "test") if err != nil { log.Fatal(err) }

    //activates the first universe
    ch, err := trans.Activate(1)
    if err != nil {
            log.Fatal(err)
    }
    //deactivate the channel on exit
    defer close(ch)

    //set a unicast destination, and/or use multicast
    trans.SetMulticast(1, true) //this specific setup will not multicast on windows,
    //because no bind address was provided

    //set some example ip-addresses
    trans.SetDestinations(1, []string{"127.0.0.1"})

    // Turn Shutter on and off
    for i := 0; i < 20; i++ {
            ch <- [512]byte{0, 255}
            time.Sleep(1000 * time.Millisecond)
            ch <- [512]byte{255, 0}
            time.Sleep(1000 * time.Millisecond)

    }

}


Now we should get an output on the Receiver. This should look like 

Started data changed on 1 data changed on 1 data changed on 1

#### However 
If we change our code to transmit on universe 2 , we dont see any packets incoming on the Receiver. 

### Wireshark 
If were transmitting Universe 1, Wireshark shows us the corresponding UDP Packets. Everything is alright. 

Now we set the Universe to 2 and no new Packets get transmitted. 
    //set a unicast destination, and/or use multicast
    trans.SetMulticast(2, true) //this specific setup will not multicast on windows,
    //because no bind address was provided

    //set some example ip-addresses
    trans.SetDestinations(2, []string{"127.0.0.1"})

#### Without Multicast 
If we comment out the `trans.SetMulticast(2, true) ` we get the same behaviour

## System Info
-  OS Ubuntu 18.10 cosmic
-  x86_64 Linux 4.18.0-10-generic
-  Shell: zsh 5.5.1
-  DE: KDE 5.50.0 / Plasma 5.13.5

Kind Regards, 
localleon
Hundemeier commented 5 years ago

Did you forgot to call ch, err := trans.Activate(2)? How did you get the correct channel? Would be nice, if you could post your not working code.

localleon commented 5 years ago

Yes, thats it.