备份-111
This commit is contained in:
parent
e78baca1d3
commit
1a5f755bbf
|
@ -34,7 +34,7 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
|||
if (p != NULL)
|
||||
{
|
||||
/* 更新窗口*/
|
||||
tcp_echo_flags_control = 1;
|
||||
|
||||
tcp_recved(tpcb, p->tot_len); // 读取数据的控制块 得到所有数据的长度
|
||||
server_pcb_control = tpcb; // 直接赋值
|
||||
memcpy(tcp_rx_data, (int *)p->payload, p->tot_len);
|
||||
|
@ -93,6 +93,7 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
|||
}
|
||||
else if (err == ERR_OK) // 检测到对方主动关闭连接时,也会调用recv函数,此时p为空
|
||||
{
|
||||
tcp_echo_flags_control = 0;
|
||||
return tcp_close(tpcb);
|
||||
}
|
||||
|
||||
|
@ -101,7 +102,7 @@ static err_t tcpecho_recv_control(void *arg, struct tcp_pcb *tpcb, struct pbuf *
|
|||
static err_t tcpecho_accept_control(void *arg, struct tcp_pcb *newpcb, err_t err) // 由于这个函数是*tcp_accept_fn类型的
|
||||
{
|
||||
tcp_recv(newpcb, tcpecho_recv_control); // 当收到数据时,回调用户自己写的tcpecho_recv
|
||||
|
||||
tcp_echo_flags_control = 1;
|
||||
return ERR_OK;
|
||||
}
|
||||
void tcp_echo_init(void)
|
||||
|
|
Loading…
Reference in New Issue