add broadcasting

This commit is contained in:
2026-07-19 23:01:36 -05:00
parent 799521f51f
commit a400b233a2
4 changed files with 43 additions and 17 deletions

View File

@@ -80,6 +80,7 @@ ErrorCode TcpClient::init() {
// listen for receive from the server
memset(buffer, 0x00, sizeof(buffer));
receiveBytes = tcpRead(socketFd, buffer, sizeof(buffer)); // TODO: this currently blocks forever, add timeout
// TODO: separate thread
// we expect a response based on the server design, something went wrong otherwise
if(receiveBytes < 0) {
@@ -91,7 +92,8 @@ ErrorCode TcpClient::init() {
return ErrorCode::Error;
}
logger_->log("TcpClient", LogFlag::Debug, "Received {} bytes back from the server", receiveBytes);
std::string receivedMessage(buffer, receiveBytes);
logger_->log("TcpClient", LogFlag::Debug, "Received {} bytes back from the server: {}", receiveBytes, receivedMessage);
}
close(socketFd);