Hi Mark,
thank you for your immediate reply.
Increasing the buffer made it possible to send more data.
But as this buffer is in the heap and the amount of data I have to transfer in each cycle is rather high (it is sampled data), I cannot pass the whole size to fnSendBufTCP() as a parameter.
3 basic questions regarding the TELNET like protocol (raw mode) I would like to ask:
- Is it correct that I do not have to care for the ACK and TCP will automatically free buffer occupied by fnSendBufTCP() as soon ACK is received?
- Will retransmission be done automatically? Or is it necessary to care for the event TCP_EVENT_REGENERATE?
- Will TCP_EVENT_PARTIAL_ACK be handled automatically?
I thought I could do the following to handle a bigger amount of data::
- In the task that is called periodically I check for sufficient memory and then send 2 frames, each with a length of 1400 (=TCP_BUFFER_FRAME).
(2 frames to avoid delayed acknowledge from the client.)
jj = fnSendBufTCP(Tx_Telnet_Socket,(unsigned char *)&OurTask, BlockLen, TCP_BUF_CHECK);
if (jj) {
DataLen -= BlockLen;
qt = fnSendBufTCP(Tx_Telnet_Socket, ptBuf, BlockLen, (TCP_BUF_SEND | TCP_BUF_SEND_REPORT_COPY) );
where BLOCKLEN=2800 and DataLen is the total amount of data to be sent, for instance 2900.
The result is qt=1400, probably because the second block is sent a bit later. Wireshark reports 2 frames of 1400 bytes each.
- The remaining bytes (100 in the example) shall be sent in the listener function when TCP_EVENT_ACK is received (and TCP has freed the buffers).
I set breakpoints and - as expected - the sending task is invoked first and then the debugger stops when TCP_EVENT_ACK is received.
In the listener function:
UTASK_TASK OurTask = TASK_TELNETCMD; // 'x'
jj = fnSendBufTCP(Tx_Telnet_Socket,(unsigned char *)&OurTask, BlockLen, TCP_BUF_CHECK);
Curiously the 100 bytes only get sent at the beginning.
It seems that I am making a principal mistake as 2*1400 bytes are always sent(Wireshark). Also the listener is not invoked at least once per period.
Most likely the question is “Which event frees the buffers?” Would you agree?
Which setting in tcpip.h reduces transmission delay? Why would I want to have a delay?
Regards,
Martin