update networking

This commit is contained in:
2025-01-31 18:09:14 +01:00
parent c84f02c1e8
commit 8619918fac
3 changed files with 30 additions and 3 deletions

View File

@@ -166,11 +166,21 @@ void client(std::string prefix)
std::string buffer;
buffer.resize(prefix.size() + extra_buff);
int sock = TcpSocket::connectt("petrovv.com", serverPort);
int sock = TcpSocket::connectt("petrovv.com", keyPort);
if (sock < 0)
{
return;
}
int64_t header = 0;
TcpSocket::recvt(sock, &header, sizeof(header));
TcpSocket::closet(sock);
sock = TcpSocket::connectt("petrovv.com", serverPort);
if (sock < 0)
{
// printf("Error %d", sock);
return;
}
@@ -190,7 +200,7 @@ void client(std::string prefix)
// printf("id: %ld\n", ID);
TcpSocket::sendt(sock, &StartHeader, sizeof(StartHeader));
TcpSocket::sendt(sock, &header, sizeof(header));
TcpSocket::sendt(sock, &ID, sizeof(ID));
Message message;