Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple callbacks per server #47

Open
joebedard opened this issue Oct 24, 2018 · 1 comment
Open

multiple callbacks per server #47

joebedard opened this issue Oct 24, 2018 · 1 comment

Comments

@joebedard
Copy link

Currently, each server (or subscriber) in simple is limited to one callback. This means that if I have more than one service (on the same node), I need to create an additional server object, which uses an additional port. For servers with many services, this could result in a complex configuration--especially if there is other server software running on that node and competing for the ports.

It would be nice to have a single server object and then add multiple services to it like this:

// assume service callbacks are defined here

int main(int argc, char * argv[]) try
{
   simple::Service<simple_msgs::Point> service1{ service1_callback };
   simple::Service<simple_msgs::Image> service2{ service2_callback };
   simple::Server server{ "tcp://*:5000", {service1, service2} };
   std::cout << "Press a key to exit.\n";
   std::cin.get();
   return 0;
}
@SalvoVirga
Copy link
Member

This would require some extensive modifications, like also allowing to receive different message types on the same socket. I will keep it in the log for the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants