24 lines
419 B
C
24 lines
419 B
C
|
#ifndef SERVER_H
|
||
|
#define SERVER_H
|
||
|
|
||
|
#include <winsock2.h>
|
||
|
#include <ws2tcpip.h>
|
||
|
#include <vector>
|
||
|
#include <mutex>
|
||
|
#include "Packet.h"
|
||
|
|
||
|
class Server {
|
||
|
public:
|
||
|
Server(unsigned short port);
|
||
|
~Server();
|
||
|
void start();
|
||
|
void broadcast(const Packet &packet);
|
||
|
private:
|
||
|
void handleClient(SOCKET clientSock);
|
||
|
SOCKET listenSock;
|
||
|
std::vector<SOCKET> clients;
|
||
|
std::mutex mutex_;
|
||
|
};
|
||
|
|
||
|
#endif // SERVER_H
|