#651·nanohttpd

How to force a single thread server?

Author: tobiascapinCreated Feb 20, 2025Updated May 31, 2025

Hi, I'm using nanohttpd as local REST api server that has to serve a single client at once. I don't want to have multiple threading due to the fact I need to process the request exacltly in the receive order and I see with the standard implementation sometimes the requests order are mixed. I tried to add a synchronized block into the server method but it didn't help, then I'm trying to understand if I can force a single-thread custom AsyncRunner but I didn't find documentation about it.

Is it possibile to define a single threaded AsyncRunner?
Do you have any other idea about?