|
From: | Tim Lambrix |
Subject: | Re: [lwip-users] tcp_write() errors on snd_queuelen |
Date: | Thu, 19 May 2011 19:49:23 +0000 |
I posted this email below a while back to which I didn’t get a response. I let it go as the code appeared to be working with the poll value of 1. Now I need to figure
out how to detect a broken connection somewhere between the lwIP device and my PC. Is there a way to use tcp_poll for this or the keep-alive or some other
detection? I can’t figure out how tcp_poll is suppose to work. My application opens a connection and must remains open until the software closes it (weeks, months or
years later). I can detect the lwIP device-to-switch link broken and the same for the PC side; just not when the link is broken between two switches in the middle. Any suggestions? I have been looking at the timers some more and trying to figure out how to get
my buffer moved during the interrupt. It looks like there are two timers: 1)
lwIPHostTimerHandler and 2) tcp_poll. I think I have to use the host timer
handler to read information out of my buffers creatively(hopefully while not in
the middle of changing it). I am trying to learn how the tcp_poll timer function works. I have a function
and set:
tcp_poll(pcb, TCP_Poll, 1); I found that increasing this value above a 1 can either A) never get called at
a half second interval and B) from wireshark, only sends data out at whatever
the value is. For example, I put a 4 in there and WireShark displays a 2
second gap between send and receives. However, with a 1 in there it sends and
receives data at a 200ms interval and if needed, due to more than one TCP
outgoing packet being full (2*TCP_MSS), it will send all packets at that time. (I can send the two Wireshark outputs showing the timing difference if it helps).
I don't understand this timer value behavior as the TCP_Poll function I have
written, doesn't really do much (residual from StellarisWare).
if ((hs == NULL) && (pcb->state == ESTABLISHED))
{ tcp_abort(pcb); return ERR_ABRT; } Is there an explanation of how the poll interval timer works this way? I found
that the TCP_SND_QUEUELEN limit is reached very quickly if the value is NOT a 1
which should map to 500 ms based on the slow TCP timer. This makes some sense
as I can send up to sixty tcp_writes in 200 ms alone. In two seconds, this is
over 200. In other words, my code only functions without crashing (with the
disable Ethernet interrupt fix around tcp_write of course) with the poll
interval set to a 1.
|
[Prev in Thread] | Current Thread | [Next in Thread] |