ReconnectAttempt Event

Fires when attempting to reconnect.

Syntax

public event OnReconnectAttemptHandler OnReconnectAttempt;

public delegate void OnReconnectAttemptHandler(object sender, SshreversetunnelReconnectAttemptEventArgs e);

public class SshreversetunnelReconnectAttemptEventArgs : EventArgs {
  public string Host { get; }
  public int Port { get; }
  public int RetryCount { get; }
  public int RetriesRemaining { get; }
  public int MaxRetryCount { get; }
  public int RetryInterval { get; }
  public int RetryType { get; }
  public int RemoteListeningPort { get; }
  public bool Cancel { get; set; }
}
Public Event OnReconnectAttempt As OnReconnectAttemptHandler

Public Delegate Sub OnReconnectAttemptHandler(sender As Object, e As SshreversetunnelReconnectAttemptEventArgs)

Public Class SshreversetunnelReconnectAttemptEventArgs Inherits EventArgs
  Public ReadOnly Property Host As String
  Public ReadOnly Property Port As Integer
  Public ReadOnly Property RetryCount As Integer
  Public ReadOnly Property RetriesRemaining As Integer
  Public ReadOnly Property MaxRetryCount As Integer
  Public ReadOnly Property RetryInterval As Integer
  Public ReadOnly Property RetryType As Integer
  Public ReadOnly Property RemoteListeningPort As Integer
  Public Property Cancel As Boolean
End Class

Remarks

This event fires when attempting to reconnect to the SSHHost or when re-establishing a SSH tunnel.

This is only applicable when AutoReconnect is set to True. This event may fire both when establishing the SSH connection, and when establishing the SSH tunnel over the SSH connection. To determine which type of connection is being established check the RetryType parameter.

The following table provides details about the parameters.

Host Hold the SSH host to which the connection is attempted.
Port Is the Port on the SSH host to which the connection is attempted.
RetryCount Indicates the current retry attempt. For instance this may be retry 2 of 5, then RetryCount will hold the value 2.
RetriesRemaining The number of retries remaining after this attempt. This number does not include the current attempt. If MaxRetryCount is set to unlimited this will return -1.
MaxRetryCount The maximum number of retries as specified in MaxRetryCount.
RetryInterval The interval (in seconds) between retry attempts as specified in RetryInterval.
RetryType The type of connection being retried. Possible values are:
  • 0 - SSH
  • 1 - Reverse Tunnel
RemoteListeningPort The port on the SSH host which the reverse tunnel will use. This is only applicable when RetryType is 1 (Reverse Tunnel).
Cancel May be set within this event to cancel the retry attempts. If set to True no further retry attempts will be executed.

Copyright (c) 2023 /n software inc. - All rights reserved.
IPWorks SSH 2020 .NET Edition - Version 20.0 [Build 8501]