
io_service.run(); printf("Writting a line 1 \n");
The io_service can't exit the run command until all the work is complete. You need to put the io_service.run() into its own thread if you want to still execute things in main. boost::thread runningService(boost::bind(&boost::asio::io_service::run, io_service)); printf("Writting a line 1 \n"); sleep(5); printf("Writting a line 2 \n"); runningService.join(); This will allow you to continue and execute code in your main function. The problem you'll run into is trying to close the thread properly. I used the HTTP Server 2 example to create a class that ran my process but responded to an outside event to signal the class to stop processing. http://www.boost.org/doc/libs/1_40_0/doc/html/boost_asio/example/http/server... Ryan