From 498fb7baf787d395221e72ad909d4a08407e7e8a Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Mon, 23 Oct 2023 16:21:15 -0400 Subject: [PATCH] lol --- SQCSim-srv/connection.h | 2 +- SQCSim-srv/server.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SQCSim-srv/connection.h b/SQCSim-srv/connection.h index 7649732..6dee988 100644 --- a/SQCSim-srv/connection.h +++ b/SQCSim-srv/connection.h @@ -33,7 +33,7 @@ private: std::map m_output_manifest; std::map m_chatlog; - SOCKET m_sock_tcp, m_sock_udp; + SOCKET m_sock; sockaddr_in m_addr; netprot::LoginInfo m_loginfo; netprot::PlayerInfo m_playinfo; diff --git a/SQCSim-srv/server.cpp b/SQCSim-srv/server.cpp index b115adf..51df967 100644 --- a/SQCSim-srv/server.cpp +++ b/SQCSim-srv/server.cpp @@ -144,7 +144,7 @@ int Server::Ready() { //netprot::Serialize(&log, &buf, &buflen); //send(sock, buf, buflen, 0); //buflen = 150; - sendPack(sock, &log, &buf, &buflen); + netprot::sendPack(sock, &log, &buf, &buflen); play.id = getUniqueId(); memcpy(play.name, log.name, std::strlen(log.name) + 1); @@ -152,7 +152,7 @@ int Server::Ready() { //netprot::Serialize(&m_game, &buf, &buflen); //send(sock, buf, buflen, 0); - sendPack(sock, &m_game, &buf, &buflen); + netprot::sendPack(sock, &m_game, &buf, &buflen); Connection* conn = new Connection(sock, sockad, log, play); m_players[log.sid] = conn; @@ -166,8 +166,15 @@ int Server::Ready() { } void Server::Run() { - + char* buf = new char[BUFFER_LENGTH]; Log("Partie en cours...", false, false); + + while (true) { + if (recv(m_sock_udp, buf, BUFFER_LENGTH, 0) > 0) { + + + } + } } inline std::string Server::LogTimestamp() {