Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beast Server Exits for reasons that Client is disconnecting? #2852

Closed
vtharmalingam opened this issue Apr 6, 2024 · 2 comments
Closed

Beast Server Exits for reasons that Client is disconnecting? #2852

vtharmalingam opened this issue Apr 6, 2024 · 2 comments

Comments

@vtharmalingam
Copy link

Version of Beast

1.84

I hope this finds you well. I've been utilizing the Beast lib successfully for over three years! Great library!

It's not a frequent occurrence, but occasionally, I encounter this error where the beast server exits with the following message. I'm curious about the possible cause and whether there's anything specific I should address, perhaps within the fail method or elsewhere? It cause some sort of stability issue. Thank you, as always!

write: An existing connection was forcibly closed by the remote host
read: The I/O operation has been aborted because of either a thread exit or an application request
read: An existing connection was forcibly closed by the remote host

Additionally, I have a question on the side:
How can I retrieve the client's IP address based on beast::ssl_streambeast::tcp_stream stream?

Thanks,
Tharma

@ashtum
Copy link
Collaborator

ashtum commented Apr 6, 2024

It's not a frequent occurrence, but occasionally, I encounter this error where the beast server exits with the following message. I'm curious about the possible cause and whether there's anything specific I should address

It appears that a client connection is being closed ungracefully based on the error messages. I'm not sure about your error handling approach, but typically, your server application shouldn't terminate due to client connection errors. It's important to anticipate that asynchronous operations on client sockets may encounter failures.

How can I retrieve the client's IP address based on beast::ssl_streambeast::tcp_stream stream?

beast::tcp_stream tcp_stream{ ioc };
beast::ssl_stream<beast::tcp_stream> ssl_stream{ ioc, ssl_ctx };

auto ep1 = get_lowest_layer(ssl_stream).socket().remote_endpoint();
auto ep2 = tcp_stream.socket().remote_endpoint();

@vtharmalingam
Copy link
Author

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants