none
SSL Socket in .Net CF 3.5 C# RRS feed

  • Question

  • Hello,

    Referring to below link I am trying to establish SSL Socket but on connect I am getting error as

    https://blogs.msdn.microsoft.com/cgarcia/2009/08/21/enable-ssl-for-managed-socket-on-windows-mobile/

    Error :

    An existing connection was forcibly closed by the remote host

    try
                {
                    var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
                    IPAddress ipAddress = Dns.Resolve("xxxxxxxx.azure-devices.net").AddressList[0];
                    IPEndPoint ipLocalEndPoint = new IPEndPoint(ipAddress, 8883);
                    SocketAddress socketAddress = ipLocalEndPoint.Serialize();
                    IPEndPoint endpoint = new IPEndPoint(ipAddress, 8883);
                    EndPoint ep = (EndPoint)endpoint.Create(socketAddress);
                    using (var sslHelper = new SslHelper(socket, "xxxxxxxxx.azure-devices.net"))
                    {
                        System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
                        socket.Connect(ep);
                    }
                }
                catch (Exception ex) { string errormsg = ex.ToString(); }



    Wednesday, August 1, 2018 6:13 AM

All replies

  • Which version of CE? (WEC7 I assume because you refer to CF 3.5)

    What update level in your kernel?

    You need the latest updates to support TLS 1.2. Does the remote server accept TLS 1.1 connections?


    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: https://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    NXP Proven Partner
    https://guruce.com
    Consultancy, training and development services.

    Interested in WEC on i.MX6?
    Get the only 100% stable and best performing i.MX6 BSP for WEC7 and WEC2013 here: https://guruce.com/imx6


    Wednesday, August 1, 2018 10:49 AM
    Moderator