Add server information to user interface and provide buttons to start and stop server, change port

This commit is contained in:
Adam Honse 2020-05-01 22:38:45 -05:00
parent b8e14ea067
commit 9e44e4ba4f
9 changed files with 341 additions and 114 deletions

View file

@ -11,18 +11,32 @@ class NetworkServer
public:
NetworkServer(std::vector<RGBController *>& control);
void ConnectionThreadFunction();
void ListenThreadFunction(SOCKET * client_sock);
unsigned short GetPort();
bool GetOnline();
void SetPort(unsigned short new_port);
void StartServer();
void StopServer();
void ConnectionThreadFunction();
void ListenThreadFunction(SOCKET * client_sock);
void SendReply_ControllerCount(SOCKET * client_sock);
void SendReply_ControllerData(SOCKET * client_sock, unsigned int dev_idx);
protected:
unsigned short port_num;
bool server_online;
std::vector<RGBController *>& controllers;
std::vector<SOCKET *> ServerClients;
std::vector<std::thread *> ListenThreads;
std::thread * ConnectionThread;
private:
net_port port;
int recv_select(SOCKET s, char *buf, int len, int flags);
};