Accept method allows operations on connection

This commit is contained in:
dawidg81 2026-03-08 16:02:08 +01:00
commit 1184ebd8bf
2 changed files with 3 additions and 5 deletions

View file

@ -50,7 +50,7 @@ int Socket::winListen()
return 0;
}
int Socket::winAccept(){
SOCKET Socket::winAccept(){
while(Socket::running){
SOCKET clientSocket = accept(mainSocket, NULL, NULL);
if(clientSocket == INVALID_SOCKET){
@ -58,8 +58,6 @@ int Socket::winAccept(){
continue;
}
log.info("Client connected");
// handling client starts here
closesocket(clientSocket);
return clientSocket;
}
return 0;
}

View file

@ -22,5 +22,5 @@ public:
int winInit();
int winBind();
int winListen();
int winAccept();
SOCKET winAccept();
};