[En-Nut-Discussion] unreliable tcp

Szemző András saam at kometa.hu
Tue Apr 8 10:11:18 CEST 2008


Hi guys,
 
Sorry for the long email...
 
I have an embedded linux based tcp receiver, which runs a small tcp server
app. I have 2 clients connected to it. One is avr based and use GPRS,
another AT91SAM7X based and use ethernet.(both use ethernut) If the
at91sam7x and the server is both on local net, there are no problems.
 
The interesting things happens, when the server is on an adsl line. Not
every adsl, just some of them has this "feature". 
My app sends alive messages in every 1min, and get answer from the server.
Both are a 16byte packet.
Normally for 10 or 20 mins everything runs ok, but randomly the at91sam7x
based client reconnect to the server, while the GPRS
client is on the server since 2 days. 
 
I tried to use Commview to capture packets, and I see the sam7x doesn't get
answer within a time. Normally it sends a PUSH ACK, get answer PUSH ACK,
and send ACK. I see when there are problems, it tries to send PUSH ACK with
retransmission, and if it gets answer it doesn't reconnect.
My app's loop send a packet if it needs, than read back the answer, and with
100ms RECV timeout tries to read to see, if he got some incoming packets.
I see when there are reconnects, the NutTcpReceive() will return with -1,
wich means socket is disconnected. (sock->so_state will be 0 in this case)
 
I tried to increase the send and receive timeout to 5000ms, but it doesn't
helped much. 
 
The interesting is I have a virtual modul running on linux, and if that is
connected once, it will be online 2 or 3 days, until you shut it down.
So I thing the problem is not server app related, just network, or adsl
related. Maybe linux's tcp stack can handle better this cases. 
 
I see retransmitted packets, so it's not that retransmit bug just checked in
the cvs. ( anyway I applied that, without help)
 
Have you got an idea what can I debug, or increase retransmit count from 7
to some bigger? (I'll make some pictures about the packets with Commview)
 
 
Thanks, 
Andras
 

----
Kometa 99 Élelmiszeripari ZRt.
Székhely: 7400 Kaposvár, Pécsi u. 67-69., Levelezési cím: 7401 Kaposvár, Pf. 58
Cégszám: Somogy Megyei Bíróság mint Cégbíróság 14-10-300239
Adószám: 13749619-2-44
Telefon: 82/502-400, Fax: 82/502-415
http://www.kometa.hu
http://www.kemencessult.hu




More information about the En-Nut-Discussion mailing list