#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.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.