[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] tcp_output doesn't flush
From: |
Thiscord |
Subject: |
[lwip-users] tcp_output doesn't flush |
Date: |
Fri, 9 Jan 2015 12:08:11 -0700 (MST) |
Hello,
I have a problem with tcp communication. I'm resending data from an
automotive network over tcp and I'm using tcp_write followed by tcp_output
to send the data immediately. I'm also using freeRTOS. I have a global TX
buffer. The access to this buffer is protected by a mutex so that different
tasks don't access it at the same time like this:
xSemaphoreTake(tcpSendProtection, portMAX_DELAY);
//put data in the TX buffer here
xQueueSendToBack( tcpSendQueue, (void *)&size, portMAX_DELAY);
The tcpSendQueue then only hands over the size of the data to send to a
dedicated send task.
The send task looks like this:
uint16 payloadLength;
while(1)
{
xQueueReceive( tcpSendQueue, &payloadLength, portMAX_DELAY );
tcp_write(cmd.pcb, txBuffer, payloadLength, 0);
xSemaphoreGive(tcpSendProtection);
tcp_output(cmd.pcb);
}
I figured that after tcp_write the data is copied into the internal lwIp
buffers so it's okay to free the mutex. However, what happens is that some
packets from the automotive network are sent multiple times in a single tcp
packet and others are not sent at all. See this wireshark capture:
<http://lwip.100.n7.nabble.com/file/n23660/ws_capture1.png>
One frame is repeated ten times (data starting 0c 08...). Does anyone have
any idea why is this happening? I'd be grateful for any suggestions.
--
View this message in context:
http://lwip.100.n7.nabble.com/tcp-output-doesn-t-flush-tp23660.html
Sent from the lwip-users mailing list archive at Nabble.com.
- [lwip-users] tcp_output doesn't flush,
Thiscord <=