YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
os/simple_receiver/simple_receiver.cpp

This reads some data from a port.

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

/*
* SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
* SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <yarp/os/Bottle.h>
#include <yarp/os/Port.h>
#include <cstdio>
int main(int argc, char* argv[])
{
YARP_UNUSED(argc);
YARP_UNUSED(argv);
Network yarp;
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;
}
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
Utilities for manipulating the YARP network, including initialization and shutdown.
Definition Network.h:706
A mini-server for network communication.
Definition Port.h:46
The main, catch-all namespace for YARP.
Definition dirs.h:16
#define YARP_UNUSED(var)
Definition api.h:162