From e52126b13cb6d5c8d6da053656ceb30fa9332337 Mon Sep 17 00:00:00 2001 From: chenyong <1521761801@qq.com> Date: Fri, 31 Aug 2018 12:20:58 +0800 Subject: [PATCH] =?UTF-8?q?1.=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91EC20=20?= =?UTF-8?q?=E4=B8=AD=E5=AF=B9=E6=9C=8D=E5=8A=A1=E5=99=A8=E4=B8=BB=E5=8A=A8?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=BF=9E=E6=8E=A5=E6=97=B6=E5=A4=84=E7=90=86?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=202.=E3=80=90=E5=88=A0=E9=99=A4=E3=80=91ESP8?= =?UTF-8?q?266=20=E4=B8=AD=E5=A4=9A=E4=BD=99=E6=97=A5=E5=BF=97=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chenyong <1521761801@qq.com> --- at_socket_ec20.c | 12 ++++++------ at_socket_esp8266.c | 5 ----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/at_socket_ec20.c b/at_socket_ec20.c index 7e50b48..375bf90 100644 --- a/at_socket_ec20.c +++ b/at_socket_ec20.c @@ -442,7 +442,7 @@ static int ec20_socket_close(int socket) int result = 0; at_response_t resp = RT_NULL; - resp = at_create_resp(128, 2, rt_tick_from_millisecond(10*1000)); + resp = at_create_resp(64, 2, rt_tick_from_millisecond(2 * 1000)); if (!resp) { LOG_E("No memory for response structure!"); @@ -906,6 +906,10 @@ static void urc_close_func(const char *data, rt_size_t size) { at_evt_cb_set[AT_SOCKET_EVT_CLOSED](socket, AT_SOCKET_EVT_CLOSED, NULL, 0); } + + /* when TCP socket service is closed, host must send "AT+QICLOSE= ,0" command to close socket */ + at_exec_cmd(RT_NULL, "AT+QICLOSE=%d,0\r\n", socket); + rt_thread_delay(rt_tick_from_millisecond(100)); } static void urc_recv_func(const char *data, rt_size_t size) @@ -997,10 +1001,6 @@ static void urc_dnsqip_func(const char *data, rt_size_t size) { at_tcp_ip_errcode_parse(result); } - else - { - LOG_D("DNS got %d IP address, ttl=%dms", ip_count, dns_ttl); - } } } @@ -1015,7 +1015,7 @@ static void urc_qiurc_func(const char *data, rt_size_t size) { RT_ASSERT(data && size); - LOG_D("qiurc : %s", data); +// LOG_D("qiurc : %s", data); switch(*(data+9)) { case 'c' : urc_close_func(data, size); break;//+QIURC: "closed" diff --git a/at_socket_esp8266.c b/at_socket_esp8266.c index 048a418..1c389c3 100644 --- a/at_socket_esp8266.c +++ b/at_socket_esp8266.c @@ -107,7 +107,6 @@ static int esp8266_socket_close(int socket) if (at_exec_cmd(resp, "AT+CIPCLOSE=%d", socket) < 0) { - LOG_E("socket(%d) close failed.", socket); result = -RT_ERROR; goto __exit; } @@ -197,10 +196,6 @@ __retry: __exit: rt_mutex_release(at_event_lock); - if (result != RT_EOK) - { - LOG_E("socket (%d) connect failed, failed to establish a connection.", socket); - } if (resp) { at_delete_resp(resp);