Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6865963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:07:16+00:00 2026-05-27T03:07:16+00:00

Hi I am reading TLPI (The Linux Programming Interface), I have a question about

  • 0

Hi I am reading TLPI (The Linux Programming Interface), I have a question about connect().

As I understand, connect() will immediately return if the pending connection numbers of listen() doesn’t reach “backlog”.
And it will blocks otherwise. (according to figure 56-2)

But for TCP socket, it will always block until accept() on server side is called (according to figure 61-5).

Am I correct?
Because I saw that in the example code (p.1265), it calls listen() to listen to a specific port and then calls connect() to that port BEFORE calling accept().

So connect() blocks forever in this case, doesn’t it?

Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:07:16+00:00Added an answer on May 27, 2026 at 3:07 am

    There’s hardly any “immediately” regarding networking, stuff can be lost on the way, and an operation that should be performed immediately in theory might not do so in practice, and in any case there’s the end to end transmission time.

    However

    • connect() on a TCP socket is a blocking operation unless the socket descriptor is put into non-blocking mode.

    • The OS takes care of the TCP handshake, when the handshake is finished, connect() returns. (that is,
      connect() does not block until the other end calls accept())

    • A successful TCP handshake will be queued to the server application, and can be accept()’ed any time later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Reading about both Linq to SQL and Entity Framework I have developed the impression
Reading this question I found this as (note the quotation marks) code to solve
Reading over the responses to this question Disadvantages of Test Driven Development? I got
Reading MSDN (and other sources) about custom report items (CRI) for reporting services 2005.
Reading through this question on multi-threaded javascript, I was wondering if there would be
reading pylons documentations I did understand that websetup:setup_app is only called when the application
Reading about how Google solves the translation problem got me thinking. Would it be
Reading online about this topic is confusing. Is there a way to cut around
Reading a post about redis I saw this word: REPL . Can someone tell
Reading CLR via C# 2.0 (I dont have 3.0 with me at the moment)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.