babelouest / ulfius

Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services
https://babelouest.github.io/ulfius
GNU Lesser General Public License v2.1
1.07k stars 183 forks source link

Need to open the REST API port continuously #233

Closed shivagittool closed 2 years ago

shivagittool commented 2 years ago

Hai @babelouest
I need to open the REST API port continuously with out closing it. so that I could able to fetch the data from front end GUI with out any data loss.

As mentioned in the below code I'm using sleep(3) instead of getchar(), so that after 3 seconds, I'm not able to fetch the data from my front end application.

Could you please help me to resolve this issue. Thank you ////////////////////////////////////////////////////////////////////////////////////////

include

include

define PORT 8080

/**

/**

babelouest commented 2 years ago

Hello @shivagittool ,

Your question isn't specific to ulfius but a matter of daemon programming.

On my case I use a pthread condition to wait for an end signal, see my projects like Taliesin or esras, but you have other solutions like forks.

You can search for "Linux daemon c example" to help you.