Why does my server socket, listening with listen(severFd,2) work with 3 terminals connected?
It should limit to 2. Does anyone know why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The second argument to
listen()states the maximum number of queued incoming requests. It is not a maximum on the number of connections that can be accepted.From man listen (where backlog is the name of the second argument):
If a maximum of two accepted connections is required then you must code that explicitly.