Skip to content
Permalink
b1393ff48b
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
59 lines (43 sloc) 1.16 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"
#include "Logger.hpp"
#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
vector<Attribute> getAllIncomingAttributes();
void startServer();
int stopServer();
DWORD lockClientThreadsMutex();
void unlockClientThreadsMutex();
private:
SOCKET *ServerSocket = NULL;
HANDLE hThread;
DWORD dwThreadId;
bool continueThread = true;
size_t numClients;
HANDLE clientThreadsMutex = NULL;
vector<DataSyncThread*> clientThreads;
};
#endif