how 2 c++ programs call each other's class/functions on same linux box?

落花浮王杯 提交于 2019-12-24 07:29:27

问题


I'm brand new to c++, so my vocab's probably off.

I currently make 100% ajax sites but want to work in websockets to autoupdate relevant clients.

I'm using fastcgi++ and websocket++. I'd like to serve all data via the websocket but update the database via ajax calls. My problem comes in when I want to have the ajax page trigger the websocket.

I've read about sockets, fifo, and pipes, but I'm not sure which one is ideal for this situation.

For two c++ programs, one ajax & one websocket, on the same linux box, how can the ajax program safely and asynchronously call a function in the websocket program?


回答1:


Have both programs talk to the same database. If you need some way to "throw a dart" at the other to notify it to check the database, you can use shared memory or a pipe. Sending one byte through the pipe is sufficient.



来源:https://stackoverflow.com/questions/15303919/how-2-c-programs-call-each-others-class-functions-on-same-linux-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!