Multiple clients !

This commit is contained in:
Adrien Bourmault 2021-07-09 02:57:26 +02:00
parent 428ac5ff4f
commit ad685d528b
No known key found for this signature in database
GPG Key ID: 6EB408FE0ACEC664
1 changed files with 2 additions and 0 deletions

View File

@ -165,11 +165,13 @@ static void *serverMain(void *server)
// Accept the data packet from client
connfd = accept(args->sockfd, (struct sockaddr*)&cli, &len);
if (connfd < 0) {
// If error is not due to lack of clients connecting, this is error
if (errno != EWOULDBLOCK) {
printLog("Server acccept failed!\n");
goto serverExiting;
}
} else {
// Client connected, creating a thread
printLog("Client accepted\n");
serverSlots[serverSlotIndex].sockfd = connfd;