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
;
22 // Wait up to ACE_DEFAULT_TIMEOUT seconds to accept connection.
23 ACE_Time_Value
timeout (ACE_DEFAULT_TIMEOUT
);
28 ACE_OS::unlink (rendezvous
);
29 ACE_OS::fdetach (ACE_TEXT_ALWAYS_CHAR (rendezvous
));
31 if (peer_acceptor
.open (ACE_SPIPE_Addr (rendezvous
)) == -1)
32 ACE_ERROR_RETURN ((LM_ERROR
, "%p\n", "open"), 1);
34 ACE_DEBUG ((LM_DEBUG
, "waiting for connection\n"));
36 if (peer_acceptor
.accept (new_stream
, 0, &timeout
) == -1)
37 ACE_ERROR_RETURN ((LM_ERROR
, "%p\n", "accept"), 1);
39 ACE_DEBUG ((LM_DEBUG
, "accepted\n"));
41 while ((n
= new_stream
.recv (buf
, sizeof buf
)) > 0)
42 ACE_OS::write (ACE_STDOUT
, buf
, n
);
48 int ACE_TMAIN (int, ACE_TCHAR
*[])
50 ACE_OS::fprintf (stderr
, "This feature is not supported\n");
53 #endif /* ACE_HAS_STREAM_PIPES */