@@ -153,6 +153,11 @@ public TimeSpan KeepAliveInterval
153153 /// </example>
154154 public event EventHandler < HostKeyEventArgs > HostKeyReceived ;
155155
156+ /// <summary>
157+ /// Occurs when server identification received.
158+ /// </summary>
159+ public event EventHandler < SshIdentificationEventArgs > ServerIdentificationReceived ;
160+
156161 /// <summary>
157162 /// Initializes a new instance of the <see cref="BaseClient"/> class.
158163 /// </summary>
@@ -390,6 +395,11 @@ private void Session_HostKeyReceived(object sender, HostKeyEventArgs e)
390395 HostKeyReceived ? . Invoke ( this , e ) ;
391396 }
392397
398+ private void Session_ServerIdentificationReceived ( object sender , SshIdentificationEventArgs e )
399+ {
400+ ServerIdentificationReceived ? . Invoke ( this , e ) ;
401+ }
402+
393403 /// <summary>
394404 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
395405 /// </summary>
@@ -532,6 +542,7 @@ private Timer CreateKeepAliveTimer(TimeSpan dueTime, TimeSpan period)
532542 private ISession CreateAndConnectSession ( )
533543 {
534544 var session = _serviceFactory . CreateSession ( ConnectionInfo , _serviceFactory . CreateSocketFactory ( ) ) ;
545+ session . ServerIdentificationReceived += Session_ServerIdentificationReceived ;
535546 session . HostKeyReceived += Session_HostKeyReceived ;
536547 session . ErrorOccured += Session_ErrorOccured ;
537548
@@ -550,6 +561,7 @@ private ISession CreateAndConnectSession()
550561 private async Task < ISession > CreateAndConnectSessionAsync ( CancellationToken cancellationToken )
551562 {
552563 var session = _serviceFactory . CreateSession ( ConnectionInfo , _serviceFactory . CreateSocketFactory ( ) ) ;
564+ session . ServerIdentificationReceived += Session_ServerIdentificationReceived ;
553565 session . HostKeyReceived += Session_HostKeyReceived ;
554566 session . ErrorOccured += Session_ErrorOccured ;
555567
@@ -569,6 +581,7 @@ private void DisposeSession(ISession session)
569581 {
570582 session . ErrorOccured -= Session_ErrorOccured ;
571583 session . HostKeyReceived -= Session_HostKeyReceived ;
584+ session . ServerIdentificationReceived -= Session_ServerIdentificationReceived ;
572585 session . Dispose ( ) ;
573586 }
574587
0 commit comments