conexus logo

messagequeue_client.cpp

Conexus::MessageQueue example client

/***************************************************************************
 *   Copyright (C) 2007 by Rick L. Vinyard, Jr.                            *
 *   rvinyard@cs.nmsu.edu                                                  *
 *                                                                         *
 *   This file is part of the conexus library.                             *
 *                                                                         *
 *   The conexus library is free software; you can redistribute it and/or  *
 *   modify it under the terms of the GNU General Public License           *
 *   version 3 as published by the Free Software Foundation.               *
 *                                                                         *
 *   The conexus library is distributed in the hope that it will be        *
 *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
 *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
 *   General Public License for more details.                              *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
 ***************************************************************************/
#include <conexus.h>
#include <iostream>

int main( int argc, char *argv[] )
{
  const char* data = "Hello World!!!";
  
  size_t written;

  if ( argc > 1 ) data = argv[1];

  Conexus::init();

  Conexus::MessageQueue::pointer mq = Conexus::MessageQueue::create("/test_queue");

  written = mq->write( data, strlen(data) );

  std::cout << "Wrote " << written << " characters to queue" << std::endl;

  return 0;
}

Generated on Wed Jul 8 15:50:07 2009 for conexus by doxygen 1.5.8