Reputation: 1530
I am creating an executable which should just listen to multiple ports and print (dump) the data. Is it possible to do it in c++? I am only getting examples for server client model.
Upvotes: 1
Views: 831
Reputation: 31441
You could create a thread per socket/port and have it do the obvious thing. You could use select to listen to the set of file descriptors and when one becomes ready do the obvious thing.
boost asio may do the heavy lifting for you. http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/tutorial.html
Upvotes: 2