1 (edited by yass007 2021-04-18 06:35:50)

Topic: Problem Reconnecting to SSH Server - Clean Disconnection

Hello Everyone,

I am working on an ssh Server based on WolfSSH. Everytime I disconnect from the server ,I get the following debug messages.
When I try to reconnect to the server It becomes impossible and I should restart the system.
I am wondering if there is a method for clean Disconnection or any variables that should be initialized after disconnecting from the server.

Thank you.

Post's attachments

wolfssl.PNG
wolfssl.PNG 9.03 kb, 1 downloads since 2021-04-18 

You don't have the permssions to download the attachments of this post.

Share

Re: Problem Reconnecting to SSH Server - Clean Disconnection

Hello yass007

Thanks for contacting wolfSSL Support. Are you calling `wolfSSH_shutdown` before attempting the reconnect?
https://github.com/wolfSSL/wolfssh/blob … nt.c#L1140

Thanks,
Eric @ wolfSSL Support

Re: Problem Reconnecting to SSH Server - Clean Disconnection

Hello Mr embhorn ,

Thank you for your quick reply.

I am getting little confused since I am working with server example project and not client project you sent.

https://github.com/wolfSSL/wolfssh/blob … ver.c#L263

In this file there is no use of 'wolfSSH_shutdown' but there is "wolfSSH_stream_exit'.

Can you please give me further explanation.

Thank you.

Share

Re: Problem Reconnecting to SSH Server - Clean Disconnection

I don't recommend following the example server source. The echoserver is the example that works.

The WOLFSSH object isn't reusable right now. I preferred to create a new WOLFSSH for each incoming connection and free it when done. Servers tend to allow multiple clients to connect simultaneously, so the echoserver can create a new object per incoming connection.

The echoserver is calling wolfSSH_shutdown. wolfSSH_stream_exit would be closing one data channel in a session, not the whole connection.

--John

Re: Problem Reconnecting to SSH Server - Clean Disconnection

Hello Mr John,
Thank you for the explanation.

Share