Sophie

Sophie

distrib > Mandriva > 10.0-com > i586 > by-pkgid > 21280410b6ea906d791d7a12afae2579 > files > 1049

libace5-doc-5.4-2mdk.i586.rpm

// FIFO-Msg-server.cpp,v 4.9 2003/11/01 11:15:23 dhinton Exp

#include "ace/FIFO_Recv_Msg.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdio.h"
#include "ace/OS_main.h"

ACE_RCSID(FIFO_SAP, FIFO_Msg_server, "FIFO-Msg-server.cpp,v 4.9 2003/11/01 11:15:23 dhinton Exp")

#if defined (ACE_HAS_STREAM_PIPES)

int
ACE_TMAIN (int, ACE_TCHAR *[])
{
  ACE_OS::unlink (ACE_DEFAULT_RENDEZVOUS);
  ACE_FIFO_Recv_Msg server (ACE_DEFAULT_RENDEZVOUS);
  char buf[BUFSIZ];
  ACE_Str_Buf msg (buf, 0, sizeof buf);
  int flags = MSG_ANY;
  int band = 0;
  int n;

  while ((n = server.recv (&band, &msg, (ACE_Str_Buf *) 0, &flags)) >= 0)
    {
      if (msg.len == 0)
	break;
      else
	ACE_DEBUG ((LM_DEBUG, "%4d (%4d): %*s",
		    msg.len, band, msg.len, msg.buf));
      flags = MSG_ANY;
      band = 0;
    }

  if (n == -1)
    ACE_OS::perror ("recv"), ACE_OS::exit (1);

  return 0;
}
#else
#include <stdio.h>
int ACE_TMAIN (int, ACE_TCHAR *[])
{
  ACE_OS::fprintf (stderr, "This feature is not supported\n");
  return 0;
}
#endif /* ACE_HAS_STREAM_PIPES */