Name
tcp_write() — Enqueue data for transmission
Synopsis
err_t tcp_write
(
struct tcp_pcb *pcb
, const void *dataptr
, u16_t len
, u8_t copy
)
;
Description
Enqueues the data pointed to by dataptr
. The length of
the data is passed in len
. The argument copy
may be either
0 or 1 and indicates whether the new memory should be allocated for
the data to be copied into. If the argument is 0, no new memory
should be allocated and the data should only be referenced by
pointer.
Return value
The tcp_write()
function will fail and return
ERR_MEM
if the length of the data exceeds the current
send buffer size (as defined by the
CYGNUM_LWIP_TCP_SND_BUF
CDL configuration option) or if
the length of the queue of outgoing segment is larger than the upper limit
defined by the CYGNUM_LWIP_TCP_SND_QUEUELEN
CDL
configuration option. The number of bytes available in the output queue can
be retrieved with the tcp_sndbuf()
function:
u16_t tcp_sndbuf
(
struct tcp_pcb *pcb
)
;
The proper way to use this function is to call the function with at most
tcp_sndbuf()
bytes of data. If the function returns
ERR_MEM
, the application should wait until some of the
currently enqueued data has been successfully received by the other host and
try again. This can be achieved with a callback function previously
provided to tcp_sent()
.
2024-12-10 | LWIP Documentation Notices |