lwip-users
[Top][All Lists]
Advanced

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

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


From: Frédéric BERNON
Subject: Re: RE : RE : [lwip-users] Problem with socket send()
Date: Mon, 27 Aug 2007 11:48:30 +0200

Hi Roland,

So, perhaps it's something you could comment in bug #20531 to keep a trace of this issue?

----- Original Message ----- From: "Winformatik Info" <address@hidden>
To: "Mailing list for lwIP users" <address@hidden>
Sent: Monday, August 27, 2007 9:53 AM
Subject: Re: RE : RE : [lwip-users] Problem with socket send()


Hi Frédéric

First of all... thank you for your help.

I talked with a friend of mine about the problem of the send(), because
he did some testing again.
You were right (... sorry about the trouble I caused).. this is the bug
about the 16-bit access on the CS8900 (bug #20531). After all we think
this problem should exists with all devices who use 16-bit access and
are not able to be accessed in 8-bit mode and its memory is not free
addressable from outside the chip.
Maybe the code of merging the buffers needs a rework... so it merges the
data content the correct way into a buffer, as long as it fits into the
maximum allowed frame size, and then writing this buffer into the CS8900.

Kind regards
Roland


Frédéric BERNON schrieb:
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
  _______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users





reply via email to

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