Performant HTTP server

Hi all, my background is in writing high performance BSD socket servers for both windows (using IO completion ports) and linux (using epoll). I’d like to write a reasonably performant RESTful HTTP server so that my Photon can communicate information over the local network to another microservice and avoid needing an active internet connection. My first thought was to start with TCPServer, but it looks like it’s pretty bare bones and doesn’t really support non-blocking IO.

That being said, it looks like the C3000 exposes a BSD socket-like interface complete with select! Before I go down this road and write a select-based HTTP server I just want to make sure I’m not missing something obvious and no one has done this already?

As an aside, am I correct in understanding that due to some peculiarities in the way the C3000 works, get_socket_active_status() is the only way to determine if a client connection has closed?

If you are talking about a Photon there is no CC3000 on the Photon.
CC3K is the WiFi chip used on the Core. The Photon runs a Broadcom WiFi module.

Thank you for the additional info. I’m still figuring out how to navigate my way around the photon source tree and setup a local build environment. Am I correct that the Photon uses FreeRTOS + lwIP for the IP stack? I’m a bit confused because I see the socket_hal functions like socket_create() etc but I also see the BSD socket functions in the lwIP code. TCPClient/TCPServer uses the socket_hal functions, but is there a reason I would pick one over the other? Are the BSD socket functions just not available?

For these internal decissions I can’t help you, that’s Particle’s point to answer - maybe @mdma can shed some light there.

The HAL isolates the application from the specifics of the networking hardware and protocol stack in use. On the Photon, we may have to switch protocol stacks to provide IPv6 support. (LwIP has not released production-ready code for IPv6 yet.) The HAL means the same application code can be used even without recompiling the code if/when system firmware ships with a different protocol stack.