2个C ++程序如何在同一个Linux机器上调用对方的类/函数? [英] how 2 c++ programs call each other's class/functions on same linux box?

查看:195
本文介绍了2个C ++程序如何在同一个Linux机器上调用对方的类/函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我目前制作100%ajax网站,但希望在websockets中工作以自动更新相关客户端。

我正在使用fastcgi ++和websocket ++。我想通过websocket提供所有数据,但通过ajax调用更新数据库。当我想让ajax页面触发websocket时,我的问题就出现了。

我读过关于套接字,fifo和管道的信息,但我不确定哪个一个是理想的情况。



对于两个c ++程序,一个ajax&一个WebSocket,在同一个Linux机器上,ajax程序如何安全地,异步地调用websocket程序中的一个函数?

解决方案

这两个程序都与同一个数据库进行通话。如果您需要某种方式来掷飞镖来通知其检查数据库,则可以使用共享内存或管道。通过管道发送一个字节就足够了。


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?

解决方案

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.

这篇关于2个C ++程序如何在同一个Linux机器上调用对方的类/函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆