⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mq_client.cpp

📁 这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用于网络游戏医学图像网关的高qos要求.更详细的内容可阅读相应的材料
💻 CPP
字号:
// MQ_Client.cpp,v 4.9 2003/11/10 01:48:03 dhinton Exp

#include "ace/SV_Message_Queue.h"
#include "test.h"

// FUZZ: disable check_for_streams_include
#include "ace/streams.h"

#include "ace/Malloc.h"
#include "ace/OS_NS_stdio.h"

ACE_RCSID(SV_Message_Queues, MQ_Client, "MQ_Client.cpp,v 4.9 2003/11/10 01:48:03 dhinton Exp")

#if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM)

int
main (int, char *[])
{
  long pid = long (ACE_OS::getpid ());
  ACE_SV_Message_Queue msgque (SRV_KEY);
  Message_Block send_msg (SRV_ID,
                          pid,
                          ACE_OS::cuserid (ACE_static_cast (char *, 0)),
                          "did you get this?");
  Message_Block recv_msg (pid);

  if (msgque.send (send_msg, send_msg.length ()) < 0)
    ACE_OS::perror ("msgque.send"), ACE_OS::exit (1);

  if (msgque.recv (recv_msg, sizeof (Message_Data), recv_msg.type ()) < 0)
    ACE_OS::perror ("msgrcv"), ACE_OS::exit (1);

  cout << "a message of length "
       << recv_msg.length ()
       << " received from server "
       << recv_msg.pid ()
       << " (user "
       << recv_msg.user () << "): "
       << recv_msg.text () << "\n";

  return 0;
}

#else

int main (int, char *[])
{
  ACE_ERROR ((LM_ERROR,
              "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
  return 0;
}
#endif /* ACE_HAS_SYSV_IPC && !ACE_LACKS_SYSV_SHMEM*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -