How to use SSL in TcpClient class

后端 未结 3 1972
庸人自扰
庸人自扰 2021-01-30 23:46

In the .NET framework there is a class TcpClient to retrieve emails from an email server. The TcpClient class has 4 constructors to connect with the se

3条回答
  •  别那么骄傲
    2021-01-31 00:19

    You can wrap the NetworkStream provided by TcpClient with an SslStream. This will provide the necessary handling of SSL and certificates.

    You may have to insert some handler code to perform a certificate validation callback, e.g. through ServicePointManager.ServerCertificateValidationCallback.

提交回复
热议问题