lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE : RE : [lwip-users] Problem with socket send()


From: Frédéric BERNON
Subject: RE : RE : [lwip-users] Problem with socket send()
Date: Wed, 22 Aug 2007 12:48:24 +0200

To disable Nagle algorithm at socket layer, call:

int iValue = 1;
setsockopt( hSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&iValue, sizeof(iValue)); 

On your socket

 
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : address@hidden 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : Winformatik Info [mailto:address@hidden 
Envoyé : mercredi 22 août 2007 11:49
À : Frédéric BERNON
Objet : Re: RE : [lwip-users] Problem with socket send()


Hi Frederic

Your suggestion with the nagle algorithm... I do not understand this 
right now. Could you please explain this in a few words (or better a 
short example). Thank you.

Your right.. The example (in pseudo code) is wrong it should be (It was 
very late last night  ;-) ):

send(SmtpState.iSocket, "abcdefgh", 8, 0); // Send_0 send(SmtpState.iSocket, 
"01234",  5, 0); // Send_1 send(SmtpState.iSocket, "ABCDEF", 6, 0); // Send_2

I looks like:

"abdcdefgh01234 ABCDEF" instead of "abdcdefgh01234ABCDEF"

This does not mean a SPACE is send, it could be any other value (in the 
range of byte). I used it only for the example.

BTW: I will also do so like Kieran suggested in his email. But give me 
some time... because I 'm very busy on an other project.

Kind regards
Roland

Frédéric BERNON schrieb:
> Hi,
>
> Can you disable the nagle algorithm to be sure? (in this case, you 
> should also have 3 frames, but, if the problem is in segment 
> concatenation, you should got good datas)
>
> About your sample, since you write :
>
> send(SmtpState.iSocket, "012345",  5, 0); // Send_1
>
> You should got "abdcdefgh01234ABCDEF" (without the "5"). Right?
>   
> ====================================
> Frédéric BERNON
> HYMATOM SA 
> Chef de projet informatique 
> Microsoft Certified Professional 
> Tél. : +33 (0)4-67-87-61-10 
> Fax. : +33 (0)4-67-70-85-44 
> Email : address@hidden 
> Web Site : http://www.hymatom.fr 
> ====================================
> P Avant d'imprimer, penser à l'environnement
>  
>
>
> -----Message d'origine-----
> De : address@hidden 
> [mailto:address@hidden De 
> la part de Winformatik Info Envoyé : mercredi 22 août 2007 10:15 À : 
> Mailing list for lwIP users Objet : [lwip-users] Problem with socket 
> send()
>
>
> Hi
>
> I have written a SMTP client and used the socket programming. I did 
> the
> programming with an old version of lwIP (prior 1.20 but newer than 
> 1.10... I think). With this version the SMTO client works like expected. 
> After switching to the latest CVS HEAD the SMTP client does not work 
> well any more.
> The problem happens if the SMTP code calls 3 times the send() function, 
> one after another and only if any of the first two calls of send() is 
> called with a odd number of bytes to send, like (pseudo code):
>
> send(SmtpState.iSocket, "abcdefgh", 8, 0); // Send_0 
> send(SmtpState.iSocket, "012345",  5, 0); // Send_1 
> send(SmtpState.iSocket, "ABCDEF", 6, 0); // Send_2
>
> If the "Send_1" would be called with an even number of bytes the 
> problem
> does not occur.
>
> After recording the frames with the Wireshark software. I found, that
> the three calls of send() resulting in one frame which is send over the 
> Ethernet (I use a CS8900 Ethernet chip with 16Bit access). But the data 
> content of the this frame seems to be wrong. It looks like :
>
> "abdcdefgh012345 ABCDEF" instead of "abdcdefgh012345ABCDEF"
>
> It seems, that the different buffers (or the data inside) used by the
> three send() calls are not merged the right way. I tracked down the 
> problem to the functions tcp_output() and tcp_output_segment(), but the 
> code is very difficult to understand.
>
> BTW: If I insert a time-out (I use a RTOS) between the send() calls 
> the
> data is send correct, of course in separate frames.
>
> I did verified the problem on to different architectures (a H8S and an
> ARM7 Hardware; means a 16- and a 32-bit system). The problem is the same 
> on both systems.
>
> Does somebody have an idea what's going wrong here ? Does somebody 
> could
> verify this behaviour ?
> Thank you very much for any help.
>
> Kind regards
> Roland
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden 
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>   

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

[Prev in Thread] Current Thread [Next in Thread]