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

View file

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