简体   繁体   中英

Cross-platform way of communcation between processes in C webserver

I made a simple webserver in C now with config implementation. Now, I want to add feature to manage server by calling same process with command line arguments. Like Nginx for example: nginx -s reload will send signal to server and it will reload config from file. I want to achieve the same. But how? In Linux, I can send a signal to server master process by getting PID from pidfile. But how to make it in Windows? Or maybe there is another way?

You can listen on a fixed port number with loopback interface for IPC. There are many cross-platform libraries like libuv and nanomsg .

--

Another method is to use some abstraction provided by a library. For example, still libuv and nanomsg . (Both use domain socket on Unix and named pipes on Windows.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM