#include <rtl.h>
U8* tcp_get_buf (
U16 size ); /* Number of bytes to be sent. */
Description
The tcp_get_buf function allocates memory for the TCP send
buffer into which your application can write the outgoing data
packet. The argument size specifies the number of data bytes
that the application wants to send.
After the TCP frame has been sent and an acknowledgement has been
received from the remote host, TCPnet automatically de-allocates the
memory used by the send buffer in tcp_send function.
A default Maximum Segment Size of 1460 bytes is defined at
startup. However, when establishing a connection with a remote
machine, TCPnet might negotiate a different (smaller) value for the
Maximum Segment Size.
The tcp_get_buf function is in the RL-TCPnet library. The
prototype is defined in rtl.h.
note
Your application must call the tcp_get_buf function each
time it wants to send a TCP data packet.
The size of the allocated memory must not exceed the TCP
Maximum Segment Size (1460 bytes).
Writing more data than the allocated size of the data
buffer overwrites the Memory Manager Block links and causes TCPnet
to crash.
Return Value
The tcp_get_buf function returns a pointer to the allocated
memory.
If memory allocation fails, TCPnet calls the sys_error
function with the code ERR_MEM_ALLOC. In TCPnet version 4.60 and
newer, if the most significant bit of argument size is set to
1 (size value or-ed with 0x8000), the function returns
a NULL pointer, and omits to call the sys_error function.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.