Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / IPC_SAP / FIFO_SAP / FIFO-Msg-server.cpp
bloba3d63dc0aaf7b14f44361c02866b1c9caf7a5550
1 #include "ace/FIFO_Recv_Msg.h"
2 #include "ace/Log_Msg.h"
3 #include "ace/OS_NS_stdio.h"
4 #include "ace/OS_NS_unistd.h"
5 #include "ace/OS_NS_stdlib.h"
6 #include "ace/OS_NS_stropts.h"
7 #include "ace/OS_main.h"
10 #if defined (ACE_HAS_STREAM_PIPES)
12 int
13 ACE_TMAIN (int, ACE_TCHAR *[])
15 ACE_OS::unlink (ACE_DEFAULT_RENDEZVOUS);
16 ACE_FIFO_Recv_Msg server (ACE_DEFAULT_RENDEZVOUS);
17 char buf[BUFSIZ];
18 ACE_Str_Buf msg (buf, 0, sizeof buf);
19 int flags = MSG_ANY;
20 int band = 0;
21 int n;
23 while ((n = server.recv (&band, &msg, (ACE_Str_Buf *) 0, &flags)) >= 0)
25 if (msg.len == 0)
26 break;
27 else
28 ACE_DEBUG ((LM_DEBUG, "%4d (%4d): %*s",
29 msg.len, band, msg.len, msg.buf));
30 flags = MSG_ANY;
31 band = 0;
34 if (n == -1)
35 ACE_OS::perror ("recv"), ACE_OS::exit (1);
37 return 0;
39 #else
40 int ACE_TMAIN (int, ACE_TCHAR *[])
42 ACE_ERROR ((LM_INFO,
43 ACE_TEXT ("This feature is not supported\n")));
44 return 0;
46 #endif /* ACE_HAS_STREAM_PIPES */