我有一个 ESP-12f 模块,我要用它来从我们公司的服务器下载几百个小文件。不幸的是,每次我下载单个文件时,连接都会关闭,我必须重新建立新的TCP连接。我已经在多个服务器上尝试过这个,总是得到相同的结果。例如,当我在 Google 上发出这些命令时:
AT+CIPSTART="TCP","google.com",80
在 cipsend=29
Google sends me the webpage data that finishes with: "CLOSE" . And then I cannot issue any new CIPSEND commands unless I re-establish the connec
tion using AT+CIPSTART="TCP","google.com",80 .
Since a TCP connection takes about 1 second to establish and I need to repeat this hundreds of times, I lose a lot of time when downloading multiple files. I also used the "TCP keep alive" parameter from the datasheet that is explained like this:
[] optional, detection time interval when TCP is kept alive,
默认情况下,此功能处于关闭状态。
0 : 禁用 TCP 保持连接状态
1~7200:检测时间间隔,单位:秒
我像这样使用了 1 和 1000:
AT+CIPSTART="TCP","google.com",80,1
AT+CIPSTART="TCP","google.com",80,1000
但是以上方法似乎都不起作用,并且在下载一个文件后,连接仍会立即关闭。
在我自己手动关闭它之前,有没有办法保持连接活动?