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)
15 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
17 ACE_SPIPE_Acceptor peer_acceptor
;
18 ACE_SPIPE_Stream new_stream
;
20 ACE_Str_Buf
buffer (buf
, 0, sizeof buf
);
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)
46 ACE_OS::write (ACE_STDOUT
, buffer
.buf
, buffer
.len
);
51 int ACE_TMAIN (int, ACE_TCHAR
*[])
53 ACE_OS::fprintf (stderr
, "This feature is not supported\n");
56 #endif /* ACE_HAS_STREAM_PIPES */