Reputation: 2482
In my tests my client gets occasionally, when trying to read from a boost socket, the error
An existing connection was forcibly closed by the remote host
I have several questions:
1) What is the Boost error code I have to check for which is associated with this message?
2) What is the analogue on Linux systems? Can I catch the same error code?
3) In the server's logs I do not see a successful connection. But the client returns successfully from its connection attempt. Also boost::asio::write()
succeeds, but also here the server does not receive anything. But when trying to read from the socket (after the send), I get above error message.
What is going on?
Upvotes: 2
Views: 3514
Reputation: 4539
In answer to your questions:
1) The boost
error code is boost::asio::error::connection_reset
; see boost/system/error_code.hpp
.
2) The analogue on linux systems is ECONNRESET
; see errno.h
.
3) connection_reset
is one of number of ways that a TCP socket can disconnect, see: How to detect when a boost TCP socket disconnects.
To determine precisely what is going on, I agree with @user
and recommend that you install and use Wireshark to observe the TCP messages between your client and server.
Upvotes: 3