Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / examples / System_V_IPC / SV_Message_Queues / MQ_Client.cpp
blob12586b1136d018fb70b1d7f5299e2fcf1816bd9d
1 #include "ace/SV_Message_Queue.h"
2 #include "test.h"
4 // FUZZ: disable check_for_streams_include
5 #include "ace/streams.h"
7 #include "ace/Malloc.h"
8 #include "ace/OS_NS_stdio.h"
9 #include "ace/OS_NS_unistd.h"
10 #include "ace/OS_NS_stdlib.h"
13 #if defined (ACE_HAS_SYSV_IPC) && !defined(ACE_LACKS_SYSV_SHMEM)
15 int
16 ACE_TMAIN (int, ACE_TCHAR *[])
18 long pid = long (ACE_OS::getpid ());
19 ACE_SV_Message_Queue msgque (SRV_KEY);
20 Message_Block send_msg (SRV_ID,
21 pid,
22 ACE_OS::cuserid (static_cast<char *> (0)),
23 "did you get this?");
24 Message_Block recv_msg (pid);
26 if (msgque.send (send_msg, send_msg.length ()) < 0)
27 ACE_OS::perror ("msgque.send"), ACE_OS::exit (1);
29 if (msgque.recv (recv_msg, sizeof (Message_Data), recv_msg.type ()) < 0)
30 ACE_OS::perror ("msgrcv"), ACE_OS::exit (1);
32 cout << "a message of length "
33 << recv_msg.length ()
34 << " received from server "
35 << recv_msg.pid ()
36 << " (user "
37 << recv_msg.user () << "): "
38 << recv_msg.text () << "\n";
40 return 0;
43 #else
45 int ACE_TMAIN (int, ACE_TCHAR *[])
47 ACE_ERROR ((LM_ERROR,
48 "SYSV IPC, or SYSV SHMEM is not supported on this platform\n"));
49 return 0;
51 #endif /* ACE_HAS_SYSV_IPC && !ACE_LACKS_SYSV_SHMEM*/