Boost Asio in Device OS

Good Day Everyone,

I am building an video and audio streaming program for the Photon 2 that requires high throughput. Currently I've been using the UDP Device OS API. After measuring (using mircos()) the throughput of echoing back 10KB of data to the Photon, it looks like the throughput is between 50 and 55Mbps. It would be desirable to get it to at least 100Mbps within of my LAN. Here is the code I'm using to measure it.

I can see from the source on GitHub (under deviceos/hal/gcc) that the Device OS is using Boost Asio under the hood. In an attempt to use Boost Asio directly in my project, I've tried including the headers which almost works but a lot of files cannot be found because it's looking for other Windows or Linux headers.

I wonder, how is the Device OS able to use Boost Asio if it's built for Windows, Mac, Linux, and what might be some tips to get Asio working natively in my Photon firmware?

Thank you.

Boost is not available in Device OS. It's used in the Device OS source tree for the gcc platform, which is a native virtual device that's used internally for testing.

Oh, I see. That's why the Readme.md says build a "Virtual Device". Thank you.

I'll keep looking for the low level implementation and see if it's feasible to use in my user firmware.

I found another UDP implementation in the source. Looks like LwIP is the more likely source of networking.

Yes, the implementation is LwIP. However I think you may run into a problem calling it from user space directly, as it's intended to be abstracted by Device OS. I'd pay closer attention to the amount of data you are processing in each time slice. Because the FreeRTOS scheduler has a 1 millisecond cadence at very high data speeds the amount of time between thread swaps becomes significant.

Is there a way to use the Device OS API without the RTOS?

I assume not.

Definitely not. As the P2/Photon 2 was designed as an IoT device, not a high speed data streaming device, I think you may have hit the maximum data transfer rate possible.

At 5 Mbytes/sec you're already getting around 10x the data transfer rate of the Photon 1.

Got it. I really like the device and the whole Particle Cloud! Just for my specific application, looks like I'm going to have to get creative.

Thank you.