Skip to content
Permalink
1eb01e12ac
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
53 lines (39 sloc) 1.01 KB
#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