@@ -27,7 +27,7 @@ public class SslClient : IDisposable
2727 /// <param name="context">SSL context</param>
2828 /// <param name="address">IP address</param>
2929 /// <param name="port">Port number</param>
30- public SslClient ( SslContext context , string address , int port ) : this ( context , new IPEndPoint ( IPAddress . Parse ( address ) , port ) ) { }
30+ public SslClient ( SslContext context , string address , int port ) : this ( context , new IPEndPoint ( IPAddress . Parse ( address ) , port ) ) { Address = address ; }
3131 /// <summary>
3232 /// Initialize SSL client with a given IP endpoint
3333 /// </summary>
@@ -36,6 +36,7 @@ public class SslClient : IDisposable
3636 public SslClient ( SslContext context , IPEndPoint endpoint )
3737 {
3838 Id = Guid . NewGuid ( ) ;
39+ Address = endpoint . Address . ToString ( ) ;
3940 Context = context ;
4041 Endpoint = endpoint ;
4142 }
@@ -45,6 +46,10 @@ public SslClient(SslContext context, IPEndPoint endpoint)
4546 /// </summary>
4647 public Guid Id { get ; }
4748
49+ /// <summary>
50+ /// SSL server DNS address
51+ /// </summary>
52+ public string Address { get ; set ; }
4853 /// <summary>
4954 /// SSL context
5055 /// </summary>
@@ -459,7 +464,7 @@ private void ProcessConnect(SocketAsyncEventArgs e)
459464 _sslStream = ( Context . CertificateValidationCallback != null ) ? new SslStream ( _sslBuffer , false , Context . CertificateValidationCallback ) : new SslStream ( _sslBuffer , false ) ;
460465
461466 // Begin the SSL handshake
462- _sslStream . BeginAuthenticateAsClient ( Endpoint . ToString ( ) , ( Context . Certificates != null ) ? Context . Certificates : new X509CertificateCollection ( new [ ] { Context . Certificate } ) , Context . Protocols , true , ProcessHandshake , this ) ;
467+ _sslStream . BeginAuthenticateAsClient ( Address , ( Context . Certificates != null ) ? Context . Certificates : new X509CertificateCollection ( new [ ] { Context . Certificate } ) , Context . Protocols , true , ProcessHandshake , this ) ;
463468 }
464469 else
465470 {
0 commit comments