Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include<SFML/Network.hpp>
- #include<iostream>
- #include<list>
- #include<thread>
- namespace pt {
- enum {handshake, goodbye, clientInfo};
- }
- class Server
- {
- public:
- Server();
- private:
- sf::IpAddress ip;
- sf::UdpSocket socket;
- unsigned short port;
- struct Client {
- sf::Time timeSinceLastPacket;
- sf::IpAddress ip;
- unsigned short port = 0;
- unsigned short id = 0;
- };
- unsigned short id;
- std::list<Client> clients;
- void run();
- std::thread listenThread;
- const unsigned short ugid = 1907;
- void removeClient(unsigned short id);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement