这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » LWIP问题求助,关于TCP_WRITE这个函数

共4条 1/1 1 跳转至

LWIP问题求助,关于TCP_WRITE这个函数

高工
2016-06-08 14:35:41     打赏

在源码中tcp_write函数的注释:

/**
 * Write data for sending (but does not send it immediately).
 *
 * It waits in the expectation of more data being sent soon (as
 * it can send them more efficiently by combining them together).
 * To prompt the system to send data now, call tcp_output() after
 * calling tcp_write().
 *
 * @param pcb Protocol control block for the TCP connection to enqueue data for.
 * @param arg Pointer to the data to be enqueued for sending.
 * @param len Data length in bytes
 * @param apiflags combination of following flags :
 * - TCP_WRITE_FLAG_COPY (0x01) data will be copied into memory belonging to the stack
 * - TCP_WRITE_FLAG_MORE (0x02) for TCP connection, PSH flag will be set on last segment sent,
 * @return ERR_OK if enqueued, another err_t on error
 */
err_t
tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)
{
  struct pbuf *concat_p = NULL;
  struct tcp_seg *last_unsent = NULL, *seg = NULL, *prev_seg = NULL, *queue = NULL;
  u16_t pos = 0; /* position in 'arg' data */

 

在注释中
tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags)

最后一个参数

 * - TCP_WRITE_FLAG_COPY (0x01) data will be copied into memory belonging to the stack
 * - TCP_WRITE_FLAG_MORE (0x02) for TCP connection, PSH flag will be set on last segment sent,


想请问,当apiflags分别为0x00,0x01,0x02 时有什么不同,分别适用于哪种情况???




关键词: 求助     LWIP     TCP_WRITE    

院士
2016-06-08 15:37:20     打赏
2楼
帮小龙顶一个吧

专家
2016-06-09 20:50:48     打赏
3楼
这个要看源码的注释了,这个不懂

高工
2016-06-10 00:53:21     打赏
4楼
看看

共4条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]