Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / examples / IPC_SAP / SPIPE_SAP / consumer_msg.cpp
blob41f0631cb293951f28f327155efaff27615f95fc
1 #include "ace/OS_main.h"
2 #include "ace/SPIPE_Addr.h"
3 #include "ace/SPIPE_Acceptor.h"
4 #include "ace/Log_Msg.h"
5 #include "ace/OS_NS_stdio.h"
6 #include "ace/OS_NS_unistd.h"
7 #include "ace/Time_Value.h"
10 #if defined (ACE_HAS_STREAM_PIPES)
12 #include "shared.h"
14 int
15 ACE_TMAIN (int argc, ACE_TCHAR *argv[])
17 ACE_SPIPE_Acceptor peer_acceptor;
18 ACE_SPIPE_Stream new_stream;
19 char buf[BUFSIZ];
20 ACE_Str_Buf buffer (buf, 0, sizeof buf);
21 int flags = 0;
23 if (argc > 1)
24 rendezvous = argv[1];
26 ACE_OS::unlink (rendezvous);
27 ACE_OS::fdetach (ACE_TEXT_ALWAYS_CHAR (rendezvous));
29 ACE_SPIPE_Addr addr (rendezvous);
30 ACE_Time_Value timeout (ACE_DEFAULT_TIMEOUT);
32 if (peer_acceptor.open (addr) == -1)
33 ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), 1);
35 ACE_DEBUG ((LM_DEBUG, "waiting for connection\n"));
37 if (peer_acceptor.accept (new_stream, 0, &timeout) == -1)
38 ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "accept"), 1);
40 ACE_DEBUG ((LM_DEBUG, "accepted\n"));
42 while (new_stream.recv ((ACE_Str_Buf *) 0, &buffer, &flags) >= 0)
43 if (buffer.len == 0)
44 break;
45 else
46 ACE_OS::write (ACE_STDOUT, buffer.buf, buffer.len);
47 return 0;
49 #else
50 #include <stdio.h>
51 int ACE_TMAIN (int, ACE_TCHAR *[])
53 ACE_OS::fprintf (stderr, "This feature is not supported\n");
54 return 0;
56 #endif /* ACE_HAS_STREAM_PIPES */