void server::ConnectTo(const std::string& sPort) { tcp::resolver::query query("127.0.0.1", sPort); tcp::resolver::iterator iterator = resolver_.resolve(query); for(int ii=0;ii<5000;ii++) { chat_client* pNewChatClient = new chat_client(io_service_,iterator,ii); } }
void connectImpl(const string& ip, int port) { deleteMe(); io_service = new boost::asio::io_service(); resolver = new tcp::resolver(*io_service); std::string val = boost::lexical_cast<std::string>(port); query = new tcp::resolver::query(ip.c_str(), val.c_str()); tcp::resolver::iterator endpoint_iterator = resolver->resolve(*query); socket = new tcp::socket(*io_service); boost::asio::connect(*socket, endpoint_iterator); }