if (tpcb) { if (++retry > MAX_RETRY_NUM) { if ((tcp_server_flag & 1<<5) == 0) { ...
//此函数用来发送数据void tcp_client_senddata(struct tcp_PCB *tpcb, struct tcp_client_struct * es){struct pbuf *ptr; err_t wr_err=ERR_OK;while((wr_err==ERR_OK)&&es->p&&(es->p->len<=tcp_sndbuf(tpcb))){ptr=es->p;wr_err=tcp_write(tpcb,ptr->payload,ptr->len,1); //将要...
(es-> p-> len < = tcp_sndbuf (tpcb)) { /* 从 es 结构中获取 pbuf 上的指针 */ ptr = es-> p; /* 将数据排队进行传输 */ wr_err = tcp_write(tpcb,ptr-> 有效载荷,ptr-> len,1); if (wr_err == ERR_OK) { u16_t plen; u8_t 已释放; plen = ptr-> len; /* 继续...
}//发送数据voidtcp_server_senddata( struct tcp_pcb *tpcb, struct tcp_server_struct *es ){structpbuf*ptr;u16 plen ;err_twr_err = ERR_OK ;while( ( wr_err==ERR_OK )&&( es->p )&&( es->p->len<=tcp_sndbuf( tpcb ) ) ) { ptr = es->p ; wr_err =tcp_write( tpcb, ptr->...
}/* close tcp connection */tcp_close(tpcb); } 注意,这里我调用了tcp_close(active_pcb)。 另一个需要注意的事情是:先调用一次tcp_bind函数,之后关闭这个tcp server,再次调用tcp_bind函数,返回错误码ERR_USE。调试发现,这个pcb在tcp_tw_pcbs上还是存在的,它由 TCP 状态 TIME_WAIT 引起,该状态在关闭后约...
* @param tpcb: pointer on the tcp_pcb connection * @param pbuf: pointer on the received pbuf * @param err: error information regarding the reveived pbuf * @retval err_t: error code*/staticerr_t tcp_echoserver_recv(void*arg,structtcp_pcb *tpcb,structpbuf *p, err_t err) ...
while ((wr_err == ERR_OK) && (es->p) && (es->p->len <= tcp_sndbuf(tpcb))){ printf...
(es->tx->len <= tcp_sndbuf(tpcb))) { ptr=es->tx;/* get pointer on pbuf from es structure & enqueue data for transmission */wr_err=tcp_write(tpcb,ptr->payload,ptr->len,1);if(wr_err == ERR_OK) { es->tx = ptr->next;if(es->tx !=NULL) { ...
buf_len = tcp_sndbuf(tpcb);if(write_len > buf_len) write_len = buf_len;//数据加入发送队列...
(es->p->len <= tcp_sndbuf(tpcb))) { ptr = es->p;/* enqueue data for transmission */wr_err = tcp_write(tpcb, ptr->payload, ptr->len, TCP_WRITE_FLAG_COPY);if(wr_err == ERR_OK) {u16_tplen;u8_tfreed; plen = ptr->len;/* continue with next pbuf in chain (if any) *...