小程序IOS连接socket报错 osstatus -9801
发布于 5 年前 作者 yuanlei 17946 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

osstatus -9801

  • 预期表现
  • 复现路径
  • 提供一个最简复现 Demo
5 回复

提供一下出现问题的机型和微信版本,以及能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

这个问题主要是服务器的问题,很有可能是你的SSL服务器没有打开TLS1.2协议

试试这个工具,看看你的服务器是否满足了TLS1.2标准

https://myssl.com/ssl.html

楼主,你解决了嘛?我现在遇到一样的问题,比较着急。

我也遇到这样到问题–OSStatus 9801

测试到手机是iPhone xs

请问问题解决了吗?

C# socket端:

namespace WebSocketTest

{

   public class Program

    {

     public static void Main(string[] args)

        {

            try

            {

 

                FleckLog.Level = LogLevel.Debug;

                var allSockets = new List<IWebSocketConnection>();

 

                var server = new WebSocketServer(“wss://0.0.0.0”);

                server.ListenerSocket.NoDelay = true;

                var currPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;

                server.Certificate = new X509Certificate2(currPath + (“MyCert.pfx”), “************”);

 

                server.Start(socket =>

                {

                    socket.OnOpen = () => Console.WriteLine(“Open!”);  //业务内容已隐藏

                    socket.OnClose = () => Console.WriteLine(“Close!”);//业务内容已隐藏

                    socket.OnMessage = message => socket.Send(message);//业务内容已隐藏

                });

                var input = Console.ReadLine();

                while (input != “exit”)

                {

                    foreach (var socket in allSockets.ToList())

                    {

                        socket.Send(input);

                    }

                    input = Console.ReadLine();

                }

            }

            catch(Exception e)

            {

                Console.WriteLine(e);

            }

        }

 

    }

}

小程序端:

wx.connectSocket({

url: “**********”,

header: {

‘content-type’: ‘application/json’

},

});

wx.onSocketError(function(res) {

console.log(‘WebSocket连接打开失败,请检查!’+res.errMsg);

//业务逻辑已隐藏

});

报错输出log为:WebSocket连接打开失败,请检查!未能完成操作。(“OSStatus”错误-9801。)

socket报错:

回到顶部