YARP  2.3.68+272-20170522.1+git50f0ae7
Yet Another Robot Platform
os/simple_receiver.cpp

This reads some data from a port.Designed to be used with os/simple_sender.cpp example.

/*
* Copyright: (C) 2010 RobotCub Consortium
* Author: Paul Fitzpatrick
* CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
*/
#include <yarp/os/Port.h>
#include <yarp/os/Bottle.h>
#include <stdio.h>
using namespace yarp::os;
int main() {
Bottle bot;
Port input;
input.open("/receiver");
// usually, we create connections externally, but just for this example...
Network::connect("/sender","/receiver");
input.read(bot);
printf("Got message: %s\n", bot.toString().c_str());
input.close();
return 0;
}