I am working on some Master/Slave functionality using the Cinder-Asio block that requires TCP as well as some UDP broadcast. TCP is working well (thanks to help from @ryanbartley), but I am having some issues with UDP.
I seem to be broadcasting UDP messages ok. I can detect them using wiresharkhttps://www.wireshark.org/ and have enabled broadcasting with sessionUdp->getSocket()->set_option(asio::socket_base::broadcast(true));. This has worked for me before to send packets to some hardware. However, even though I can connect a UDP client to the port (on the same machine) it never receives anything. My experience with receiving broadcasts in past is just with OSC libraries and has not required specifying an IP like I need to here. Should I be able to connect to localhost and receive any broadcast messages?
Any help appreciated.
nay.
EDIT - this also did not work with the address â0.0.0.0â, which I take it is what I should be using for the listener. I should probably look at multicasting instead broadcasting for this application but keen to get one of these options working.
Okay, so I managed to get UDP multicasting working by using asio directly. I managed to get these samples running inside Cinder by taking a look at how the OSC block uses standalone asio and switching out the boost dependant code in the samples. Getting it from there into my code was straight forward.
It wasnât as tricky as I had expected dealing w Asio directly although admittedly this was a very simple use case. Later on I might try doing this for the TCP functionality too but for now Iâm just glad it all works!
Noted. Shouldnât be tough to add a simple way into multicasting in the next round of updates. If you want to fork and PR, it would be a good way to chat through further API design. Iâm not not forums much these days, but I try to be responsive on Github.
I tried creating Multicast application but got an error as cannot input âlibboost_date_time-vc120-mt-sgd-1_58.libâ . Searched for same file but couldnt get. Have created project with tinderbox and using boost which comes with cinder. Where can I get that lib?
Cinder comes with the full boost source, but to reduce the size of the distribution, it only contains pre-compiled libraries for a few components. You will have to compile date-time yourself. A full description can be found here.
Just a note, if youâre using asio in Cinder, you shouldnât need boost date_time. You should only need that if youâre trying specifically to not use ASIO_STANDALONE. Thereâs nothing i believe other than deadline_timer that uses boost in asio anymore (Even that was replaced by basic_waitable_timer). Most likely why it was trying to find âlibboost_date_time-vc120-mt-sgd-1_58.libâ is because there was likely an #include "asio..." somewhere that wasnât preceded by a #define ASIO_STANDALONE. If you can find that the error should go away.
Yes I am using asio in cinder and have got that error. I tried compiling with the syntax provided by @nay but it didnt work. Thank you @paul.houx for that tutorial.
If you could, search in your project and throughout the block for any includes like #include "asio/..." lines and add #define ASIO_STANDALONE above it.