evanpurkhiser / prolink-go

golang library to interface with Pioneers PRO DJ Link network
MIT License
74 stars 9 forks source link

Failed broadcast detection on /26 subnet #8

Closed jkrcma closed 6 years ago

jkrcma commented 6 years ago

Function getBroadcastAddress returns incorrect address inside my network. Had to hardcode the IP address to make it working for my show.

# ip a
19: eth0@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:bc:fa:7d brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 192.168.1.21/26 brd 192.168.1.63 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:febc:fa7d/64 scope link
       valid_lft forever preferred_lft forever
# tcpdump -n dst port 50000 and udp
listening on enp4s0, link-type EN10MB (Ethernet), capture size 262144 bytes
20:53:49.854088 IP 192.168.1.7.50000 > 192.168.1.63.50000: UDP, length 54
20:53:50.231466 IP 192.168.1.3.54140 > 192.168.1.63.50000: UDP, length 54
20:53:50.413371 IP 192.168.1.9.50000 > 192.168.1.63.50000: UDP, length 54
20:53:50.942529 IP 192.168.1.21.50000 > 192.168.1.255.50000: UDP, length 54
20:53:51.854022 IP 192.168.1.7.50000 > 192.168.1.63.50000: UDP, length 54
20:53:52.238930 IP 192.168.1.3.54161 > 192.168.1.63.50000: UDP, length 54
20:53:52.415743 IP 192.168.1.9.50000 > 192.168.1.63.50000: UDP, length 54
20:53:52.442461 IP 192.168.1.21.50000 > 192.168.1.255.50000: UDP, length 54

.3 is a desktop PC with Rekordbox .7 is DJM-900NXS .9 is CDJ-2000NXS .21 is prolink-overlay virtual machine

evanpurkhiser commented 6 years ago

Yeah I'm aware of this.. it's actually kind of tricky to get the real network mask from an interface.. Go only gives me back the default mask.

evanpurkhiser commented 6 years ago

Actually I was wrong, you can get the mask and this was easier than I suspected :)

brunchboy commented 6 years ago

Have you seen any of the stuff I have been committing to dysentery and Beat Link lately? I am now able to take over the tempo and beat grid, so Beat Link Trigger can make CDJs sync to Ableton Link (as well as the other direction which has worked almost since Ableton Link was released). You can tell players to load tracks and start or stop playing, or become tempo master or turn sync on or off. Now I am figuring out how to navigate the menu tree that dbserver provides, and just implemented the ability to search the database by a text substring.

brunchboy commented 6 years ago

Ah! I just saw some of your other issues, and that you are implementing some of the new stuff. Fun! 😁

evanpurkhiser commented 6 years ago

@brunchboy Yeah! Sorry I hadn't had a chance to respond to your email! Everything you've been working through has been amazing, I've been following along! I was going to add in a few of the features including track loading, start stop, tempo control, pretty soon. And hopefully get to implementing the cue points, loops, beatgrid, wavedata stuff as well at some point.

I was going to focus a bit on the usability, ergonomics, and documentation of the livestream overlay stuff I had done. My plan right now was to pull out the JSON websocket stuff from the overlay and turn that into a prolink-server daemon, which would be a web API / websocket server that clients can connect to, configure, and query through a HTTP API. I want to be able to just set it up as a systemd service on my small home server and just let it chug along, and anytime I decide to live stream I can just talk to the prolink server and it will just "work". The idea being to provide a easy interface to build ontop of for things like JSON tracklist files (that can be transformed to m3u playlists), a "now playing" widget on websites, the livestream overlay of course, etc. I'm not sure if such a thing would be low-latency enough for high precision real time stuff (like syncing things to beats), but maybe :)

brunchboy commented 6 years ago

That sounds like a great plan. I get questions sometimes from people wanting to do live stream overlay stuff, now I know I should send them your way.

If you are using web sockets over the loopback interface, rather than going over an actual network, it might be fast enough for beat synchronization. I have to do that in order to talk to my Carabiner daemon to synchronize with Ableton Link, both to bridge between the Java and C++ runtimes, and between the Eclipse and GPL license realms.

I wish when I started writing Beat Link Trigger I had realized it was going to be more than a demonstration project for other people who might want to use my Beat Link library; now it is my most-downloaded project by far, and I wish I could separate the UI from the core engine to make it easier for people who want to run it headless, but it was thrown together in a rapid prototyping way that means that separation will require a complete rewrite today, and I’d always rather be adding new features instead.