Like Tree2Likes
  • 1 Post By vart
  • 1 Post By gemera

listen() function backlog parameter

This is a discussion on listen() function backlog parameter within the Networking/Device Communication forums, part of the General Programming Boards category; What is the second parameter's use in layman terms? I set it to 0 and still can connect with multiple ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    796

    listen() function backlog parameter

    What is the second parameter's use in layman terms?
    I set it to 0 and still can connect with multiple clients?
    I thought it was for the number of clients.
    (windows, tcp, multiclient server)
    Compiler MSVC++ 2013 with Code::Blocks.

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    have you read the manual?

    The backlog argument defines the maximum length to which the queue of pending connections for sockfd may grow. If a connection request arrives when the queue is full, the client may receive an error with an indication of ECONNREFUSED or, if the underlying protocol supports retransmission, the request may be ignored so that a later reattempt at connection succeeds.
    When you set this parameter to 0
    if your second connection request arrives when the first is still being processed - you could get the error.

    How much is the chance of this to occur - when you a manually generating connect request - very low IMHO.
    Ducky likes this.
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    796
    Yes, I read it but didnt understand.
    So it is only for the time being it is processed.
    Indeed it is processed very fast so on a manual connection its no big deal.

    Thanks Vart.
    Compiler MSVC++ 2013 with Code::Blocks.

  4. #4
    Registered User
    Join Date
    Mar 2012
    Location
    the c - side
    Posts
    254
    For sockets on Windows the Winsock FAQ here is a good resource.

    You'll find a good answer to this question and others.

    There's also an option to download the whole thing to your local disk for easy reference.
    Ducky likes this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. function parameter/ function argument
    By codecaine_21 in forum C Programming
    Replies: 2
    Last Post: 09-24-2010, 08:09 PM
  2. how to add a parameter to the function
    By jayfriend in forum C Programming
    Replies: 5
    Last Post: 01-16-2007, 08:31 PM
  3. Replies: 13
    Last Post: 08-24-2006, 12:22 AM
  4. the listen() function
    By Da-Nuka in forum Networking/Device Communication
    Replies: 9
    Last Post: 03-07-2005, 01:44 PM
  5. Parameter in a function
    By cpluspluser in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2003, 07:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21