hello everyone,
i am making a tcp chat server using c in linux. i have used socket programming to connect the server and the client.
can anyone please let me know how i can use forking for multiple clients??
thank you
You usually fork() after the accept(); in the child you close the listening socket and continue the processing with the connected socket returned by accept(); while in the parent you close the connected socket and call accept() again.
You need to handle the termination of the children in the parent process; otherwise you'll get zombie processes hanging around.
HTH, Lo�c