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

Switch off AutoReconnect on gracefully disconnect #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PoschmannChristianScheugenpflug

Client would like to immediately reconnect even if explicit disconnect is wished. Solved by add a second Disconnect method

  • Disconnect method set AutoReconnect to false
  • Added DisconnectAndReconnect method

Exception from ReadAsync when client was disposed

  • Catch exception if stream object is null after it client was disposed

Minor changes on demo (no pull needed) ;

Added DisconnectAndReconnect method;
Minor changes on demo;
if (readLength <= 0)
{
if (readLength == 0)
{
Message?.Invoke(this, new AsyncTcpEventArgs("Connection closed remotely"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message will be invoked even if connection was disconnected locally because readAsync always return 0

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

Successfully merging this pull request may close these issues.

1 participant