void getClientConnection (tcp::acceptor &acceptor) {
		std::cout << "In GUIMessageSenderThread getClientConnection()" << std::endl;
		try
		{
			std::cout << "waiting for gui client to connect..." << std::endl;
			acceptor.accept(*stream_.rdbuf());
			std::cout << "...gui client connected" << std::endl;
			connected_ = true;
		}
		catch (std::exception& e)
		{
			std::cerr << "Error in gui client connection: " << e.what() << std::endl;
		}
		std::cout << "done GUIMessageSenderThread getClientConnection()" << std::endl;
	}
Exemple #2
0
void acceptorLoop()
{
	cout << "Waiting for clients..." << endl;

	for(;;)
	{
		socket_ptr clientSock(new tcp::socket(service));

		acceptor.accept(*clientSock);

		cout << "New client joined! ";

		mtx.lock();
		clientList->emplace_back(clientSock);
		mtx.unlock();

		cout << clientList->size() << " total clients" << endl;
	}
}