It would actually be better if you move the construction of the client outside of the try block (that's better style) and don't need to make this complicated with the shared io_service.