SSHChannelOpenRequest Event
Fired when a host attempts to open a new channel.
Syntax
public event OnSSHChannelOpenRequestHandler OnSSHChannelOpenRequest; public delegate void OnSSHChannelOpenRequestHandler(object sender, SshclientSSHChannelOpenRequestEventArgs e); public class SshclientSSHChannelOpenRequestEventArgs : EventArgs { public string ChannelId { get; } public string Service { get; } public string Parameters { get; }
public byte[] ParametersB { get; } public bool Accept { get; set; } }
Public Event OnSSHChannelOpenRequest As OnSSHChannelOpenRequestHandler Public Delegate Sub OnSSHChannelOpenRequestHandler(sender As Object, e As SshclientSSHChannelOpenRequestEventArgs) Public Class SshclientSSHChannelOpenRequestEventArgs Inherits EventArgs Public ReadOnly Property ChannelId As String Public ReadOnly Property Service As String Public ReadOnly Property Parameters As String
Public ReadOnly Property ParametersB As Byte() Public Property Accept As Boolean End Class
Remarks
This event is fired whenever a host attempts to open a new channel. ChannelId will contain the id of the channel to be created. Service will identify the type of channel that is being requested (e.g.: "session"). Set Accept to true to accept the channel open request.
If the channel open request contains extra information, it will be contained in Parameters; you can extract data from it using GetSSHParam and GetSSHParamBytes. The most common example of a request with parameters would be a request with Service set to "direct-tcpip" (for SSH tunneling); in that case Parameters will contain the host to connect (string), the port to connect (int), the originator IP address (string) and the originator TCP port (int).