我试图在arduino-esp32 32框架上的安全wifi连接上设置一个连接超时。我的代码是:
const uint32_t RESPONSE_TIMEOUT = 30;
WiFiClientSecure client;
client.setTimeout(RESPONSE_TIMEOUT);
if (!client.connect(currentHost.c_str(), port)) {
ESP_LOGI(TAG, "Cannot connect to %s", currentHost.c_str());
display(3, " E", "connection lost");
goto failure;
}这将成功打开wifi连接,但它会记录此错误:
E setSocketOption():1006 :9
0x1006定义为
SO_RCVTIMEO 0x1006 /*接收超时*/
错误9被定义为
EBADF 9 /*坏文件号*/
我被困在这里了。什么意味着坏的文件号,为什么不能这样设置套接字流超时?有谁可以帮我?
发布于 2019-01-16 14:49:47
你不能在setTimeOut之前拥有client.connect。您必须先建立连接。
https://stackoverflow.com/questions/53152590
复制相似问题