Back to FlowSsh Documentation

Shutdown Function/Method

[C]

void __cdecl FlowSshC_Shutdown();

[C++]

[Initializer] void Shutdown();
[Initializer] ~Initializer() { Shutdown(); }

[C#]

[SshNet] public static void Shutdown();

Methods and Parameters

  • [C] FlowSshC_Shutdown: Shutdowns the library.
     
  • [Cpp] Shutdown: Invokes FlowSshC_Shutdown().
  • [Cpp] ~Initializer: Invokes FlowSshC_Shutdown().
     
  • [Net] Shutdown: Invokes FlowSshC_Shutdown().

Remarks

Shutdown should be called before exiting the process, for instance, right before returning from the main function ([C] or before calling FreeLibrary if FlowSshC.dll is loaded dynamically). Handlers may be called during shutdown, however, no handler can be called once shutdown is complete. Shutdown will never raise FlowSshC/Cpp/Net errors.

What shutdown does is disconnect/abort any connected/connecting client and closes all opened/opening channels. It then waits for all FlowSshC threads to finish gracefully.* Furthermore, it frees resources acquired during the initialization and releases all the library internal references to client, channel, and handler objects. What shutdown does NOT do is destroy objects that haven't yet been disposed. Example: If your code holds a reference to a client object, this object won't be deleted from memory by the Shutdown call. The object will be deleted later, as soon as you code releases it.

* The following functions create a new FlowSshC thread:

  • [Client]Connect
  • [ClientSessionChannel]OpenRequest
  • [ClientSftpChannel]Open
  • [ClientSftpChannel]List
  • [ClientSftpChannel]Upload
  • [ClientSftpChannel]Download

[C] After shutdown finishes, FlowSshC may be used normally if initialized again with FlowSshC_Initialize. In [Cpp/Net] this is not supported.