mohan
mohan

Reputation: 1530

Just listen to Multiple port

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

Answers (1)

Seth Robertson
Seth Robertson

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

Related Questions