> 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.