Added an event to search for servers.

Client now broadcasts a serverlistrequest.
An active server will then answer the request and send info about the server.
The client saves this data to a list and presents it to the user.
This commit is contained in:
stiffly
2016-02-19 15:38:09 +01:00
parent 46987beefb
commit 2f259c3773
12 changed files with 178 additions and 51 deletions
+7 -2
View File
@@ -16,8 +16,9 @@ public:
void Send(Packet & packet, PlayerDefinition & playerDefinition);
void Send(Packet & packet);
void Disconnect();
int Port() { return acceptor->local_endpoint().port(); }
std::string Address();
int Port() { return m_Port; }
std::string Address() { return m_Address; }
private:
// TCP logic
boost::asio::io_service m_IOService;
@@ -28,6 +29,10 @@ private:
int& nextPlayerID, std::map<PlayerID, PlayerDefinition>& connectedPlayers,
const boost::system::error_code& error);
int readBuffer(char* data, PlayerDefinition& playerDefinition);
int GetPort();
std::string GetAddress();
int m_Port = 0;
std::string m_Address = "";
};
#endif