update networking
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user