Author Topic: Http server and missing images  (Read 11922 times)

Offline svl

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Http server and missing images
« on: January 30, 2009, 08:34:00 AM »
Hi Mark
Have been playing with the HTTP server for a while and got it to work with a SD card.
My problem is now that all the images on my web page are not loaded every time and there are no consistent in witch images there are missing.
I am using it together with dynamical web pages as well, but even when I disable this part the images are not appearing as well.
When I debug the fnDoWebPage function I can see that the missing images not are requested in this function.
But that most strange is that it when using Wireshark to track the communication between the computer and the controller, it dos not looks like the image is “requested”???

Any ideas?

Steen

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Http server and missing images
« Reply #1 on: January 30, 2009, 12:05:04 PM »
Hi Steen

If the browser is not requesting the image it may be that the HTML tag which is telling the browser that it should do this is corrupted in some way.
Check the HTML content in the Wireshark recording to see whether this may be the case. Also try different browsers just to see whether there is a change in reaction.

Regards

Mark

Offline svl

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Http server and missing images
« Reply #2 on: April 02, 2009, 08:07:51 AM »
Hi Mark

I am still struggling with this problem, and are finally come to a part where I think that I can see a pattern and have theory.
But to prove my theory I need some one (Read you  ;)) to help me.
I have for some time been focus on the data that are transmitted between the browser and the uTasker and found that all data are good and that valid.

My search for the problem has gotten me to the part where I have tried difference scenario:
1:       
        //#define HTTP_WINDOWING_BUFFERS     2
        //#define HTTP_IGNORE_PARTIAL_ACKS
        #define NO_OF_HTTP_SESSIONS        1
In this case the http speed are slow and that are expected. But when using this configuration multiple images/files are not transmitted to the browser and it is very constant.

2:       
        #define HTTP_WINDOWING_BUFFERS     2
        #define HTTP_IGNORE_PARTIAL_ACKS
        #define NO_OF_HTTP_SESSIONS        2
The speed is moderate and the images/file is transmitted most of the times received.

3:       
        #define HTTP_WINDOWING_BUFFERS     4
        #define HTTP_IGNORE_PARTIAL_ACKS
        #define NO_OF_HTTP_SESSIONS        3
The speed is high and the all the images/file are transmitted and well received by the browser.

When looking at this information I get the idea that when we have high speed and the browser never is turned down when asking for data everything is perfect.
But at low speed the browser are “turned” down some times in a wrong way and this gives the missing images/files.

So my guess it that some were in the fnHTTPListener, request that can not be handled by the uTasker are handled wrong.
Dos this makes sense or do I have a point?
See the tcp dump as ref.

Regards
Steen

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Http server and missing images
« Reply #3 on: April 02, 2009, 05:14:33 PM »
Hi Steen

I think that the basic problem may be with the value for NO_OF_HTTP_SESSIONS. This is the number of 'parallel' HTTP connections which are possible.
When you serve a web pages with graphics (or other embedded content like a java script file or a css file) the web browser will immediately try to open these, while still reading the original HTML file.

I note that, in the attached Wireshark recording, there are a lot of TCP RST. It looks as though the recording was made with the session quantity set to 1.

a) Frame 6 is the GET of the start file (0.htm).
b) Frame 7 is the first frame of this file, including some references to graphics (like back-ground image and more).
c) Frame 8. The browser has not yet acked the frame that it has received but has already interpreted its content and is trying to read one of these images (SYN to start a new HTTP session).
d) Frame 9. The SYN is being responded to with a RST since there are no more HTTP sessions to connect to.

The second session will be attempted again after a delay, as well further sessions (to other images) attempted. But as long as the first (main) session is still connected, all will be rejected.

e) Frame 26. This is where the first session terminates and only after this point is is possible to connect again (get get images etc.).
f) Frame 32. Finally a java script file is requested (which was probably rejected one or more times previously).

I suspect that there are various sub-files and some are being rejected so many times that the browser gives up and so doesn't display all images, etc.


When using complex web page content you need to ensure that you have enough sessions defined to enable them to be connected in parallel.

This presumably explains why the results get better when you have 3 sessions defined. Also, the speed of the serving may play a roll since the sessions will be closed faster, making space for further ones to be accepted.

I suggest generally setting NO_OF_HTTP_SESSIONS to a much higher value. Say 10, which should allow two or three browsers to connect to a complex web page at the same time (if it could ever happen). A session only requires about 72 bytes of RAM memory (including windowing support) - the demo project has 4 set up as default, which is suitable for its web pages with a couple of integrated graphics.

HTTP_WINDOWING_BUFFERS can be left at 2 for windowing operation.

Do you then get good results?

Regards

Mark





Offline svl

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Http server and missing images
« Reply #4 on: April 03, 2009, 03:04:32 PM »
Hi Mark.

Have just tried to increase the number of NO_OF_HTTP_SESSIONS to 10, but it looks like the HEAP are out of room in my app. :(

I have tried to se what is using all the memory, and can see that NUMBER_OF_RX_BUFFERS_IN_ETHERNET_DEVICE and NUMBER_OF_TX_BUFFERS_IN_ETHERNET_DEVICE takes quiet some space.
Can i reduce this and still have a good preformenc?

Regard Steen

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Http server and missing images
« Reply #5 on: April 03, 2009, 07:39:50 PM »
Hi Steen

Have you tried increasing the heap size? OUR_HEAP_SIZE in config.h?
As long as you still have enough stack (see the values for heap and stack on the admin web page for example) you can increase the heap to make room for the additional sessions.

Regards

Mark

Offline svl

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Http server and missing images
« Reply #6 on: May 20, 2009, 09:18:42 AM »
Hi Mark

Have tried to increase the NO_OF_HTTP_SESSIONS to 10 and it looks mutch bether now.

I will do some more testing and get back with the result.

But regarding the question on number of NUMBER_OF_RX_BUFFERS_IN_ETHERNET_DEVICE and NUMBER_OF_TX_BUFFERS_IN_ETHERNET_DEVICE, is this a fix number or can it be change ant still have a reliable system. Alternative can the size of LAN_BUFFER_SIZE be change?
The reason for the question is that I need extra SRAM for my application 

Regards Steen

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3236
    • View Profile
    • uTasker
Re: Http server and missing images
« Reply #7 on: May 20, 2009, 09:37:38 AM »
Hi Steen

The number of LAN transmit buffers should not be reduced below NUMBER_OF_TX_BUFFERS_IN_ETHERNET_DEVICE since the EMAC tends to send two frames when this is tried (this is detailed in the device errata).
NUMBER_OF_RX_BUFFERS_IN_ETHERNET_DEVICE can be reduced but the risk of overruns does increase as the number gets smaller. You will need to find out when it starts to become noticeable.

LAN_BUFFER_SIZE can also be reduced (keep to multiples of 16 in size) but it will mean that Ethernet frames size reduces and thus (multiple-frame) transmission times increase a bit. If the LAN buffer size is reduced, HTTP_BUFFER_LENGTH and TCP_BUFFER_FRAME can also be reduced accordingly.

Regards

Mark


Offline svl

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Re: Http server and missing images
« Reply #8 on: May 20, 2009, 09:41:20 AM »
Thanks Mark

I will give it a try and see whan happens.

Regards Steen