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

@@ -114,11 +114,27 @@ void call(int sock, sockaddr_in newSocketInfo)
TcpSocket::closet(sock);
}
void send_key(int sock, sockaddr_in newSocketInfo)
{
TcpSocket::sendt(sock, &StartHeader, sizeof(StartHeader));
TcpSocket::closet(sock);
}
void listen_key()
{
int err = TcpSocket::listent("0.0.0.0", keyPort, send_key);
if (err < 0)
{
printf("ERROR %d", err);
}
}
int main()
{
sql::init();
sql::create_tables();
std::thread t(checker);
std::thread l(listen_key);
// Bind the server to a port.
int err = TcpSocket::listent("0.0.0.0", serverPort, call);
if (err < 0)