lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Problem with socket send()


From: Winformatik Info
Subject: [lwip-users] Problem with socket send()
Date: Wed, 22 Aug 2007 10:15:11 +0200
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

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





reply via email to

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