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