Couple of thoughts:
in reply to Simultaneously reading from a file and serving data
- Split the tasks between two processes, and rather than sharing memory, use a shared database. You could even just have a shared file that contains your JSON and flock on updates.
- Use threads and share the associated datastore (e.g. HoH) between the two using threads::shared
- Use alarm to implement a timeout on your socket read.
Any of these sound promising?
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.