From 78f7974f1cd3731b74bdcf89f682f53f4571f51d Mon Sep 17 00:00:00 2001 From: MarcEricMartel Date: Tue, 31 Oct 2023 15:06:03 -0400 Subject: [PATCH] OH YEAH. --- SQCSim-common/netprotocol.cpp | 6 ++++-- SQCSim-common/netprotocol.h | 2 +- SQCSim2021/connector.cpp | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SQCSim-common/netprotocol.cpp b/SQCSim-common/netprotocol.cpp index e440eae..6f74856 100644 --- a/SQCSim-common/netprotocol.cpp +++ b/SQCSim-common/netprotocol.cpp @@ -855,7 +855,7 @@ std::vector netprot::recvPacks(SOCKET sock, Buffer* buf) { cmp = memcmp(cursor, &footer, sizeof(uint64_t) + sizeof(uint8_t)); if (cmp == 0) { lsPck.push_back(last); - cursor += sizeof(uint64_t) + sizeof(uint8_t) + 1; + cursor += sizeof(uint64_t) + sizeof(uint8_t); last = cursor; next = cursor + 1; } @@ -867,7 +867,9 @@ std::vector netprot::recvPacks(SOCKET sock, Buffer* buf) { }; } } - + for (int x = 0; x < buf->len; ++x) + std::putchar(buf->ptr[x]); + std::puts(""); } template <> diff --git a/SQCSim-common/netprotocol.h b/SQCSim-common/netprotocol.h index 57b865f..c5c0777 100644 --- a/SQCSim-common/netprotocol.h +++ b/SQCSim-common/netprotocol.h @@ -19,7 +19,7 @@ namespace netprot { }; struct Buffer { // Pour pouvoir rendre l'utilisation des buffers plus clean. - char* ptr = new char[BUFFER_LENGTH]; + char* ptr = new char[BUFFER_LENGTH] { 1 }; uint32_t len = BUFFER_LENGTH; ~Buffer() { delete[] ptr; } diff --git a/SQCSim2021/connector.cpp b/SQCSim2021/connector.cpp index aa2040e..af54e9b 100644 --- a/SQCSim2021/connector.cpp +++ b/SQCSim2021/connector.cpp @@ -107,10 +107,10 @@ int Connector::Connect(const char* srv_addr, std::string name) { break; } } - if (lsPck.empty()) - errors++; + //if (lsPck.empty()) + //errors++; lsPck.clear(); - if (errors > 1000000) + if (errors > 1000) return 4; } return 0;