ESP8266上的Arduino WiFiClientSecure间歇性连接失败

时间:2018-09-03 06:00:08

标签: c++ arduino esp8266 arduino-esp8266

我看到使用WiFiClientSecure(ESP8266 Arduino-core)连接到端口433上的主机的间歇性连接失败。下面的调试日志显示,握手在收到服务器问候后停止。我不知道如何解密跟踪中的更详细信息。

跟踪中的最后一个信息是Alert: close notify

客户端当前配置为通过证书指纹或证书链验证服务器的真实性。在AFAIU中,它甚至还没有达到可以尝试这样做的阶段。因此,这似乎无关紧要。

版本:ESP8266 Arduino-core 2.4.2

素描代码段

WiFiClientSecure client;
Serial.printf("Connecting to: %s:%d\n", HOST.c_str(), PORT);
if (client.connect(HOST, PORT)) {
  client.println("GET " + path + " HTTP/1.1");
  // and so on
} else {
  Serial.println("Connection failed");
}

首次亮相输出

Connecting to: thingpulse.com:443
[hostByName] request IP for: thingpulse.com
[hostByName] Host: thingpulse.com IP: 217.26.52.113
:ref 1
:ref 2
State:  sending Client Hello (1)
:wr 95 95 0
:wrc 95 95 0
:sent 95
:rn 536
:rch 536, 536
:rch 1072, 536
:rch 1608, 536
:rd 5, 2144, 0
:rdi 536, 5
:rd 80, 2144, 5
:rdi 531, 80
State:  receiving Server Hello (2)
:rd 5, 2144, 85
:rdi 451, 5
:rd 2054, 2144, 90
:rdi 446, 446
:c 446, 536, 2144
:rdi 536, 536
:c 536, 536, 1608
:rdi 536, 536
:c 536, 536, 1072
:rdi 536, 536
:c0:rch 536, 536
 536, 536
:rn 152
:rd 152, 152, 0
:rdi 152, 152
:c0 152, 152
pm open,type:2 0
:ur 2
Alert: close notify
Connection failed

0 个答案:

没有答案