So, I got this program running on my mac, ipMidi, that allows me to send midi events through my ethernet connection. It works under UDP protocol and is sending midi from my Ableton Live daw. I'm trying to read, in the same machine that is running ipMidi, the packages from ipMidi into my C++ program, but I can't figure out how to do this. I've been doing research for some time know and I just can't figure out how to get the ipMidi to send the packages to my local host or to sniff the packages going through my ethernet. One of the tools that I found out was route, but I can't manage to duplicate the ip table entry to send the packages to my listening UDP program. Other way that I find to do this was to make my program join a multicast group on the kernel i n the destination ip and port from the destination package I sniffed from ipMidi with wireshark, but this isn't possible cause the bind tells me that the address is being used. So I really could use some help on this.
There's no code, I know, but is more like a theoretical thing than and implementation problem.
Hope I explained myself clearly, my english isn't the best.
Thanks for your time.
It seems that you are open to different techniques. I am not a networking expert, and I am not at all expert with iptables, but I would try to look for a "tee" equivalent for iptable. I found this link that may be useful to you.
https://unix.stackexchange.com/questions/15870/iptables-port-mirroring
EDIT: another one that could be useful http://www.bjou.de/blog/2008/05/howto-copyteeclone-network-traffic-using-iptables/
Another hack it comes into my mind is that, if you can control where the ipMidi sends the packet, you can send them to localhost on a certain port, having
netcat
open to listen on that port, then usingtee
to redirect the output on a file and read that file with your C++ program. The output oftee
would to, again, tonetcat
which could send the data where you like (another host).It would be like:
But this is just an idea to try if nobody comes with a better solution (unlikely).