Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
bfs/breadcrumbs/include/AlgorithmServer.hpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
53 lines (39 sloc)
1.01 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ALGORITHM_SERVER_HPP | |
#define ALGORITHM_SERVER_HPP | |
#undef UNICODE | |
#define WIN32_LEAN_AND_MEAN | |
#include <windows.h> | |
#include <winsock2.h> | |
#include <ws2tcpip.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <vector> | |
#include "CMakeConfig.h" | |
#include "DataSyncThread.hpp" | |
#define ALGORITHM_PORT "10101" | |
#define MAX_ACCEPT_FAILURES 5 | |
#pragma comment (lib, "Ws2_32.lib") | |
class AlgorithmServer | |
{ | |
public: | |
AlgorithmServer(size_t numClients); | |
~AlgorithmServer(); | |
void serverThreadRuntime(); | |
static DWORD serverThreadInit(LPVOID pThreadArgs) | |
{ | |
AlgorithmServer* pAlgorithmServerThread = (AlgorithmServer*)pThreadArgs; | |
pAlgorithmServerThread->serverThreadRuntime(); | |
return NULL; | |
} | |
// Updates Algorithm key/value store with IO key/value updates | |
void pollForUpdates(); | |
void startServer(); | |
void stopServer(); | |
private: | |
HANDLE hThread; | |
DWORD dwThreadId; | |
bool continueThread = false; | |
size_t numClients; | |
std::vector<DataSyncThread> clientThreads; | |
}; | |
#endif |