Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component


Index of Chilkat Blog Posts

September 23, 2007

WSAECONNABORTED - An understandable explanation.

The WSAECONNABORTED error is a TCP/IP socket error that is understood by virtually nobody. Hopefully, this blog post will provide an explanation that clarifies the error and why/when it occurs.

First, the WSAECONNABORTED is represented in a Chilkat LastErrorText as this error:
SOCKET_ERROR: An established connection was aborted by the software in your host machine.

Yes, it’s cryptic and useless… (sorry about that).

Here are the best explanations you might find by searching the Internet, but still they don’t give a clear picture of what’s happening (unless you really understand what you’re reading):

Berkeley description:
A connection abort was caused internal to your host machine. The software caused
a connection abort because there is no space on the socket’s queue and the socket
 cannot receive further connections.
	
WinSock description:
Partly the same as Berkeley. The error can occur when the local network system aborts
a connection. This would occur if WinSock aborts an established connection after data
retransmission fails  (receiver never acknowledges data sent on a datastream socket).
	
TCP/IP scenario:
A connection will timeout if the local system doesn’t receive an (ACK)nowledgement for
data sent.  It would also timeout if a (FIN)ish TCP packet is not ACK’d
(and even if the FIN is ACK’d, it will eventually timeout if a FIN is not returned).

Here’s a scenario that produces the WSAECONNABORTED error on the client-side. Once you read this scenario, go back and read the explanations above, and they will make more sense…

The Scenario:
An HTTP POST is to be sent to an HTTP server.
The server begins reading the POST and notices that the HTTP request header is invalid.
It immediately sends an HTTP response (with an error status, perhaps status=400) and closes the connection without trying to continue reading the remainder of the HTTP request that is forthcoming.

Meanwhile, the client is still happily writing the remainder of the HTTP request to the socket. (Remember a TCP/IP socket connection needs to be closed from both sides. In this case, the server has closed its side, but the client is still pumping data into the half-open connection.)
The client finishes writing the HTTP POST to the socket — meaning that data has been buffered to Winsock. The client application then tries to read the HTTP response, but it cannot because the outgoing retransmission (of the buffered data by WinSock) failed and the socket connection was shutdown on the client side (by Winsock). Even though the HTTP server sent the response, it is lost and cannot be retrieved. The error your application will receive when
trying to read the HTTP response on the socket is WSAECONNABORTED. The word "software" in any of the above error messages refers to "WinSock".

Go back and re-read the original error explanations. Hopefully, after that explanation, you’ll say "Aha! I understand what they’re talking about!".


Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to support@chilkatsoft.com

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.