Inputhandler calls async_connect which returns to one of its members. Which works through the first run.

How to solve this?

Probably, your io_service object has no more pending work, so its run() loop exits? Look at the "work" class in asio reference.