Reputation: 1492
i gone through with the lots material of networking in c and also searched a lot on internet, but still there is doubt in mind that what is purpose of backlog in listen ().
Note :- i also gone through the with same question/answer in stackoverflow, but still m confused.
can any one explain me in simple language?
And if backlog queue in listen is number of pending or incomplete request than if i provided 5 in backlog parameter, still more than 5 connection can also connect.
thanks.
Upvotes: 1
Views: 377
Reputation: 27562
When you listen
on a port, under the covers TCP will complete your connections (i.e. the 3 way handshake) and put them in a queue up to the size of the backlog queue. When you accept
a connection your pgm begins to process it and that slot opens in the queue for another (potential) connection. So if you are currently processing (have accepted) 5 connections and you have a backlog size of 5 then another 5 connections can still be made by the tcp layer.
Upvotes: 2