serialization

This commit is contained in:
MarcEricMartel
2023-09-25 16:30:03 -04:00
parent 035436c639
commit 4c2e8a12ad
10 changed files with 239 additions and 59 deletions

View File

@@ -79,14 +79,16 @@ int Server::Ready() {
Log("<EFBFBD> l'<27>coute sur le port: " + std::to_string(SRV_PORT), false, false);
while (!readystart) {
Log("trololo", false, false);
// Listen/accept ici.
readystart = true;
}
return 0;
}
void Server::Run() {
Log("Partie en cours...", false, false);
}
@@ -131,6 +133,32 @@ void Server::Log(std::string str, bool is_error = false, bool is_fatal = false)
}
}
// Test serialize/deserialize:
/*
netprot::LoginInfo* log = new netprot::LoginInfo();
char nom[] = "Jean Dujardin";
memcpy(log->name, &nom, sizeof(nom));
log->sid = 12345;
char* buf = new char[150];
uint32_t buflen = 150;
netprot::Serialize(log, &buf, &buflen);
delete log;
log = new netprot::LoginInfo();
bool is_work = netprot::Deserialize(log, buf, buflen);
std::string str;
str.append(is_work ? "Y " : "N ").append(log->name).append(": ").append(std::to_string(log->sid));
Log(str, false, false);
*/
///* Recevoir paquet */
//while (true) {
// char buffer[2048];