TCPIP_TCP_ArrayPut Function
C
uint16_t TCPIP_TCP_ArrayPut(
TCP_SOCKET hTCP,
const uint8_t* Data,
uint16_t Len
);
Description
Writes an array from a buffer to a TCP socket.
Preconditions
TCP is initialized.
Parameters
Parameters | Description |
---|---|
hTCP | The socket to which data is to be written. |
data | Pointer to the array to be written. |
len | Number of bytes to be written. |
Returns
The number of bytes written to the socket.
If less than len, the buffer became full or the socket is not connected.
Remarks
This operation can cause a TCP packet to be transmitted over the network (i.e., a TCPIP_TCP_Flush operation to be performed) when there is data in the TCP TX buffer that can be sent and any of the following occurs:
There is no more space available in the TCP buffer.
The TCP_OPTION_THRES_FLUSH_ON is set and the TX buffer is at least half full
The amount of data that can be sent is bigger than the remote host MSS or than half of the maximum advertised window size.
The Nagle algorithm is disabled and there is no unacknowledged data.
If none of these occur and the socket user does not add data to the TX socket buffer, the TCP state machine will automatically flush the buffer when the TCP_AUTO_TRANSMIT_TIMEOUT_VAL time-out elapsed.
The default TCP_AUTO_TRANSMIT_TIMEOUT_VAL is 40 ms.