1 #include "ace/OS_main.h"
2 #include "ace/SPIPE_Addr.h"
3 #include "ace/SPIPE_Connector.h"
4 #include "ace/Log_Msg.h"
5 #include "ace/Truncate.h"
6 #include "ace/OS_NS_string.h"
7 #include "ace/OS_NS_stdlib.h"
8 #include "ace/OS_Memory.h"
11 #if defined (ACE_WIN32)
12 #define MAKE_PIPE_NAME(X) ACE_TEXT ("\\\\.\\pipe\\") ACE_TEXT (X)
14 #define MAKE_PIPE_NAME(X) ACE_TEXT (X)
17 const int DEFAULT_SIZE
= 8;
18 const int DEFAULT_COUNT
= 10000;
21 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
23 int size
= argc
> 1 ? ACE_OS::atoi (argv
[1]) : DEFAULT_SIZE
;
24 int iterations
= argc
> 2 ? ACE_OS::atoi (argv
[2]) : DEFAULT_COUNT
;
31 const ACE_TCHAR
*rendezvous
= MAKE_PIPE_NAME ("acepipe");
33 ACE_SPIPE_Stream cli_stream
;
34 ACE_SPIPE_Connector con
;
37 if (con
.connect (cli_stream
,
38 ACE_SPIPE_Addr (rendezvous
)) == -1)
39 ACE_ERROR_RETURN ((LM_ERROR
,
44 ACE_OS::strcpy (buf
, "hello");
45 size
= ACE_Utils::truncate_cast
<int> (ACE_OS::strlen (buf
) + 1);
47 for (i
= 0; i
< iterations
; i
++)
48 if (cli_stream
.send (buf
, size
) != size
)
49 ACE_ERROR_RETURN ((LM_ERROR
,
54 if (cli_stream
.close () == -1)
55 ACE_ERROR_RETURN ((LM_ERROR
,