Tcp长连接
Re: Tcp长连接
Postby younger » Thu Feb 12, 2015 1:48 pm
Espressif_Faye wrote:您好,
espconn_regist_time 设置 TCP 服务器超时时间,单位为秒,可参考编程手册。
如果设为 0 ,则保持连接永远不会断开。
建议将超时时间设置长一点,而不建议设置为永远不断开。。这不科学,浪费资源~ 对吧
我试了下
Code: Select all
void ICACHE_FLASH_ATTR
user_webserver_init(uint32 port)
{
LOCAL struct espconn esp_conn;
LOCAL esp_tcp esptcp;
esp_conn.type = ESPCONN_TCP;
esp_conn.state = ESPCONN_NONE;
esp_conn.proto.tcp = &esptcp;
esp_conn.proto.tcp->local_port = port;
espconn_regist_time(&esp_conn,0,0);
espconn_regist_connectcb(&esp_conn, webserver_listen);
#ifdef SERVER_SSL_ENABLE
espconn_secure_accept(&esp_conn);
#else
espconn_accept(&esp_conn);
#endif
}
没有任何作用,还是在10s后会自动断开。
麻烦乐鑫确认下。
Who is online
Users browsing this forum: No registered users and 193 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.