i wish to start a server that will allow multipile connections at once at first i thout about forking but then i realized that it will consume alot of resorses.
so i started googling about threads and i thout that it is wiser to use threads for this condition .
as from example on socket for linux tutorial
what will be the apropreate code with treads ?
newsockfd = accept(sockfd,
(struct sockaddr *) &cli_addr, &clilen);
if (newsockfd < 0)
error("ERROR on accept");
pid = fork();
if (pid < 0)
error("ERROR on fork");
if (pid === 0)
} /* end of while */
my server will get a string from a uniqe client accses a database retrive a aporeate data from database
start sevral function on this data
and return an answer to the client