コード例 #1
0
ファイル: loginserver.cpp プロジェクト: ArahEmu/gate-server
void LoginServer::Run(LoginServer *Instance)
{
    ServerSocket runningSocket;
	if (runningSocket.Configure(Instance->m_ServerPort) == false) {
		printf("Unable to establish server socket, there is an issue with the server.\n");
		return;
	}

    while (Instance->m_Running) {
        /*
         * Listen For New Connections.
         */
        ClientConnection baseClient = runningSocket.Accept();
        LoginClient* client = new LoginClient(baseClient);

        /*
         * Lock client array and place the client in the queue
         */
        Instance->m_ClientsLock.lock();
        Instance->m_Clients.push_back(client);
        Instance->m_ClientsLock.unlock();
    }

    runningSocket.Flush();
}