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 7635675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:29:11+00:00 2026-05-31T07:29:11+00:00

I’m using python 2.7 on an ubuntu machine. The client tries to connect to

  • 0

I’m using python 2.7 on an ubuntu machine.

The client tries to connect to the server. I get a EINPROGRESS which is expected for non-blocking sockets.

To check whether or not the connection succeeded, I do what the man page for {connect} suggest:

# EINPROGRESS The socket is nonblocking and the connection cannot be
# completed immediately.  It is possible to select(2) or poll(2) for
# completion by selecting the socket for writing.  After select(2)
# indicates writability, use getsockopt(2) to read the SO_ERROR option at
# level SOL_SOCKET to determine whether connect() completed successfully
# (SO_ERROR is zero) or unsuccessfully (SO_ERROR is one of the usual error
# codes listed here, explaining the reason for the failure)

When the server is offline, this gives me a ECONNREFUSED. So far so good.

When the connection fails, I want to try again a few times.

Problem: the second time I try to connect that same socket, {connect} sends me ECONNABORTED. This one isn’t in the man page of {connect}. What does it mean?

  • 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-31T07:29:13+00:00Added an answer on May 31, 2026 at 7:29 am

    ECONNABORTED is set in two places of the Linux Kernel Source Socket Code.

    As per the errno man page and /include/asm-generic/errno.h

    #define ECONNABORTED 103 /* Software caused connection abort */

    The first is in the function that defines the syscall accept4 in /net/socket.c.

    Relevant Source Code

    1533         if (upeer_sockaddr) {
    1534                 if (newsock->ops->getname(newsock, (struct sockaddr *)&address,
    1535                                           &len, 2) < 0) {
    1536                         err = -ECONNABORTED;
    1537                         goto out_fd;
    1538                 }
    1539                 err = move_addr_to_user((struct sockaddr *)&address,
    1540                                         len, upeer_sockaddr, upeer_addrlen);
    1541                 if (err < 0)
    1542                         goto out_fd;
    1543         }
    

    The relevant explanation of logic is below.

    If the address of the peer socket from userspace is defined
    and If the new socket doesn’t have name, then set error state to ECONNABORTED and goto the label out_fd.

    The second is in the function that defines the symbol inet_stream_connect in /net/ipv4/af_inet.c.

    Relevant Source Code

    645         /* Connection was closed by RST, timeout, ICMP error
    646          * or another process disconnected us.
    647          */
    648         if (sk->sk_state == TCP_CLOSE)
    649                 goto sock_error; 
    
    662 sock_error:
    663         err = sock_error(sk) ? : -ECONNABORTED;
    664         sock->state = SS_UNCONNECTED;
    665         if (sk->sk_prot->disconnect(sk, flags))
    666                 sock->state = SS_DISCONNECTING;
    667         goto out;
    

    The relevant explanation of logic is below.

    The only code that has a goto to the sock_error label in inet_stream_connect is the check to see if the socket was closed by RST,timeout, another process or error.

    In the sock_error label
    If we can recover a socket error report, do so , otherwise the error state to ECONNABORTED

    Like Celada‘s comment I also recommend opening a new socket each time.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
We're building an app, our first using Rails 3, and we're having to build

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.