connector
object is build with a constructor that specify the pointer of the handler function and the connection is started.
At this point when an incoming message arrives, handler function is called.
To let the connector
object continue to listen to TCP stack is important that main loop will not end.
If your program doesn't have a listen loop is mandatory to insert such loop into tha main()
function of your program.
To let the system listen to other events usleep()
function may be used inside your listen loop.
An example is reported here:
#include <unistd.h> ... void myhandler(openmaia::message) { std::cout << "incoming message" << std::endl; } ... int main() { openmaia::connector *c = new openmaia::connector(myhandler); ... while(true) { ulseep(50); } }