简体   繁体   English

我可以通过boost :: interprocess :: message_queue发送C ++类对象吗?

[英]Can I send a C++ class object via boost::interprocess::message_queue?

How do I send a c++ class object via boost::interprocess::message_queue ? 如何通过boost::interprocess::message_queue发送c ++类对象?

Can someone share sample code for an IPC implementation using boost::interprocess::message_queue with IPC data as a Class object? 有人可以使用boost::interprocess::message_queue与IPC数据作为Class对象共享IPC实现的示例代码吗?

How can i send c++ class object via boost::interprocess::message_queue?

//Class Defination
#define MQ_DATA             IPCMsg
class IPCMsg
{
public:
IPCMsg() { data = NULL; }
int len;
void* data;
};

// Initialize message Queue
mSendMq = new message_queue(OPEN_OR_CREATE, "MQ", 1024, sizeof(MQ_DATA));
mReceiveMq = new message_queue(OPEN_ONLY, "MQ");

// Send Data to message Queue
MQ_DATA* inData = new IPCMsg();
mSendMq->send(inData, sizeof(*inData), 0);

// Receive Data from message Queue
MQ_DATA* outdata = NULL;
mReceiveMq->receive(&outdata, sizeof(*outdata), 1024, priority);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 boost :: interprocess :: message_queue使用Visual C ++停止在发布模式下工作 - boost::interprocess::message_queue stops working in Release mode with visual C++ boost interprocess message_queue和fork - boost interprocess message_queue and fork boost :: interprocess :: message_queue权限被拒绝 - boost::interprocess::message_queue permission denied boost::interprocess::message_queue 在第二个进程中没有收到消息 - boost::interprocess::message_queue no message received in second process boost :: interprocess message_queue-Windows 7低完整性进程 - boost::interprocess message_queue - Windows 7 low integrity process 使用boost :: interprocess :: message_queue多个应用程序安全吗? - Is it safe to consume a boost::interprocess::message_queue multiple applications? 错误:“ size_type”不是“ boost :: interprocess :: message_queue”的成员 - error: ‘size_type’ is not a member of ‘boost::interprocess::message_queue’ boost::interprocess message_queue 性能 - 相当慢? - boost::interprocess message_queue performance - rather slow? 如何序列化boost :: function以在message_queue中发送它 - How serialize a boost::function to send it in a message_queue Boost进程间message_queue具有非常量get_num_msg()。 为什么? - Boost interprocess message_queue has non const get_num_msg(). Why?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM