problems serving larger data with netconn_write()

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

problems serving larger data with netconn_write()

Andre Puschmann
Hey Folks,
we are using lwip on a custom ppc-based board.
there is a small web-server running on the board which uses the raw
lwip-api.

for some reason the server lacks serving a sample bmp-image.
the header is transmitted correctly but lwip only sends a few bytes of
the real image data.


here is a code snippet:

for (ul_BytesSent = 0; ul_PackageSize < ul_BytesToSend; ul_BytesSent +=
ul_PackageSize)
{
        netconn_write( ps_newconn,
                        pub_Image + ul_BytesSent,
                        ul_PackageSize,
                        NETCONN_NOCOPY);

        ul_BytesToSend-=ul_PackageSize;
}
/* send rest */
...

and some ethereal captured data ..
it seems that the ack's are incorrect. ethereal mistake?
don't wonder about all the 0x00 :-)

thank you very much for any help!!


regards
andi

_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

capture (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: problems serving larger data with netconn_write()

Alan L
Andre Puschmann <andre.puschmann@...> writes:

> here is a code snippet:
>
> for (ul_BytesSent = 0; ul_PackageSize < ul_BytesToSend; ul_BytesSent +=
> ul_PackageSize)
> {
> netconn_write( ps_newconn,
> pub_Image + ul_BytesSent,
> ul_PackageSize,
> NETCONN_NOCOPY);
>
> ul_BytesToSend-=ul_PackageSize;
> }
> /* send rest */
> ...

Is your image sotting in a constant array in ROM? - I didn't have any luck when I tried to pass netconn_write() a pointer to ROM.  I chose a different path and never resolved that problem.

I noticed you don't adjust the PackageSize for the last packet - most likely the image size does not equal an even number of PackageSizes.  You should include something like this (before netconn_write) to adjust the last PackageSize...

        if ( (ul_BytesToSend-ul_BytesSent) < ul_PackageSize )
                ul_PackageSize = ul_BytesToSend-ul_BytesSent;

I attached an wireshark Logo jpg load.pcaptrace of a web page retrieval and image GET example, if it helps.  I've run into the "TCP segment of a Reassembled PDU" sending POST data to my hardware, but don't understand it enough to offer advice.

Regards,
Alan

Reply | Threaded
Open this post in threaded view
|

Re: problems serving larger data with netconn_write()

Andre Puschmann
hi folks,
sorry for the delay ..
i figured out that it was the internet explorer setting the reset flag
after receiving a "wrong header" .. my mistake, sorry!

now it works quite fast, but only with the 750byte hack .. which means
i force lwip to send two 750byte packets in order to get an ACK .. not
the best solution, i reckon.

another question:
is it possible that the internet explorer doesn't like negative heights
in bitmap files which means that the picture is top-down coded instead
of bottom-up.
normal windows programs like Paint understand this file format.


regards
Andre





Alan Lamphier wrote:

> Andre Puschmann <andre.puschmann@...> writes:
>
>> here is a code snippet:
>>
>> for (ul_BytesSent = 0; ul_PackageSize < ul_BytesToSend; ul_BytesSent +=
>> ul_PackageSize)
>> {
>> netconn_write( ps_newconn,
>> pub_Image + ul_BytesSent,
>> ul_PackageSize,
>> NETCONN_NOCOPY);
>>
>> ul_BytesToSend-=ul_PackageSize;
>> }
>> /* send rest */
>> ...
>
> Is your image sotting in a constant array in ROM? - I didn't have any luck
> when I tried to pass netconn_write() a pointer to ROM.  I chose a different
> path and never resolved that problem.
>
> I noticed you don't adjust the PackageSize for the last packet - most likely
> the image size does not equal an even number of PackageSizes.  You should
> include something like this (before netconn_write) to adjust the last
> PackageSize...
>
> if ( (ul_BytesToSend-ul_BytesSent) < ul_PackageSize )
> ul_PackageSize = ul_BytesToSend-ul_BytesSent;
>
> I attached an wireshark
> http://www.nabble.com/file/3611/Logo%20jpg%20load.pcap Logo jpg load.pcap
> trace of a web page retrieval and image GET example, if it helps.  I've run
> into the "TCP segment of a Reassembled PDU" sending POST data to my
> hardware, but don't understand it enough to offer advice.
>
> Regards,
> Alan
>
>



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: problems serving larger data with netconn_write()

Alan L
Andre Puschmann <andre.puschmann@...> writes:
>
> now it works quite fast, but only with the 750byte hack .. which means
> i force lwip to send two 750byte packets in order to get an ACK .. not
> the best solution, i reckon.
>

On the third packet and beyond, you should be able to take the packet size up to
your MSS setting - this worked for me.

Regards,
Alan



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: problems serving larger data with netconn_write()

Andre Puschmann
Hi,

Alan Lamphier wrote:
> Andre Puschmann <andre.puschmann@...> writes:
>> now it works quite fast, but only with the 750byte hack .. which means
>> i force lwip to send two 750byte packets in order to get an ACK .. not
>> the best solution, i reckon.
>>
>
> On the third packet and beyond, you should be able to take the packet size up to
> your MSS setting - this worked for me.

i will try if this works, thank you.


after initializing the lwip stack and sending the first couple of bytes
everything goes quite fast. i am sending files of ~300kb.

i am downloading this file multiple times from the board with wget
(windows binary) and with every single transfer the download speed
constantly decreases (right tense?). from beginning 1,1mb/sec to
150kb/sec in something about ~30kb to ~100kbyte steps.
after a while it completely collapses. nothing is working.
netconn_accepts() blocks the whole time.

i also figured out that this has something to do with MEM_SIZE and
others. but i couldn't get this fixed.
for instance at a size of ~500kb the above mentioned behavior appears
after ~7 file transfers. with 1000kb MEM_SIZE i couldn't bring it to
collapse but its getting really sloooow. (like already mentioned at the
list).


>
> Regards,
> Alan

Regards

Andre



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users