try
  {
  
//for(int i=1;i<8;i++){
    boost::asio::io_service io_service;
    s11n_example::client client(io_service, "localhost", "9999");
    io_service.run();
sleep(7);
  }
 
 
 
Doesn't your debugger allow you to see what line of your code throws the exception?
Anyway, try to change "localhost" to "127.0.0.1" - maybe the resolver fails to resolve it.