[boost.asio] error Software caused connection abort

Hello, When I use a tcp socket to connect to remote host, I may get an "actively refused" or "time out" error in 1st time. That's normal. Then when I retry to connect to remote host, I "always" got "Software caused connection abort" error for every rtrial. It seems a programming issue. Could anyone explain what this error mean and how to avoid it? or point me to some document? Thanks Imin

When I use a tcp socket to connect to remote host, I may get an "actively refused"
WSAECONNREFUSED == 10061
or "time out" error in 1st time.
WSAETIMEDOUT == 10060
Then when I retry to connect to remote host, I "always" got "Software caused connection abort"
WSAECONNABORTED == 10053 http://msdn.microsoft.com/en-us/library/ms740668%28VS.85%29.aspx I don't know why you say the former two are "normal" -- actually all the tree mean that there's a problem with your host sockets: either there's no listening socket or it closes an accepted socket, or there's some other issue in the host.

When I use a tcp socket to connect to remote host, I may get an "actively refused"
WSAECONNREFUSED == 10061
or "time out" error in 1st time.
WSAETIMEDOUT == 10060
Then when I retry to connect to remote host, I "always" got "Software caused connection abort"
WSAECONNABORTED == 10053
http://msdn.microsoft.com/en-us/library/ms740668%28VS.85%29.aspx
I don't know why you say the former two are "normal" -- actually all the tree mean that there's a problem with your host sockets: either there's no listening socket or it closes an accepted socket, or there's some other issue in the host.
Thanks a lot for helping. I'm still a newbie in asio/socket programming. The socket may be used to connect to a remote host behind NAT which may send back a RST packet or silently drop it. This is expected response. It seems "Software caused connection abort" error is related to my program. The document you pointed confirms this: "An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error." The way I use can be sketched by: ============================ open a tcp socket bind to a port asynchronously connect to a remote host in callback if it fails (may get expected errors), asynchronously reconnect to remote host, up to specified times In callback I get "abort" error after every reconnect Any further help to debug this is appreciated.

The way I use can be sketched by: ============================ open a tcp socket bind to a port asynchronously connect to a remote host in callback if it fails (may get expected errors), asynchronously reconnect to remote host, up to specified times In callback I get "abort" error after every reconnect
Any further help to debug this is appreciated.
I guess the server (host) closes the connection for some reason, so you have to debug your server and see what happens there after an incoming connection is accepted. BTW, there's a dedicated asio mailing list: http://news.gmane.org/group/gmane.comp.lib.boost.asio.user

The way I use can be sketched by: ============================ open a tcp socket bind to a port asynchronously connect to a remote host in callback if it fails (may get expected errors), asynchronously reconnect to remote host, up to specified times In callback I get "abort" error after every reconnect
Any further help to debug this is appreciated.
I guess the server (host) closes the connection for some reason, so you have to debug your server and see what happens there after an incoming connection is accepted.
BTW, there's a dedicated asio mailing list: http://news.gmane.org/group/gmane.comp.lib.boost.asio.user
Thanks. This is very helpful information. I found the direct reason. After a failed connect, the socket has been somehow closed. So reconnect cannot be carried out.
participants (2)
-
Igor R
-
imin imup