Webserver problem : need a segmented transmission

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi, I'm to set up a little webserver on a mega1280 which shows some measured data. I'm currently using the server from tuxgraphics and it's doing well so far. But it has the limitation to one packet per webpage. As there are lots of datasets which are dynamically pulled in over a serial communication from another controller and then built together to a site one packet isn't enough. Now I've read a little and surfed through some forums, wikis and projects this morning but I haven't found how a segmented transmission to e.g. a webbrowser really works. In the
http://de.wikipedia.org/wiki/Transmission_Control_Protocol it is shown theoretically but at least I couldn't extract what info I have to put in which header. Can someone enlighten me ?
Thank you very much,
Mat

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

you might want to look at uip (contiki) or lwip as your tcp/ip stack. The tuxgraphics one is cheap n cheerful but you've hit the end of the road with it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Get Wireshark if you haven't already, it decodes the various fields and shows the details of segment reassembly. Then download a sample capture file to look at, e.g. http://wiki.wireshark.org/SampleCaptures?action=AttachFile&do=view&target=http.cap

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yeah, well, I'm looking at it with wireshark but is there some explanation to it ? I don't get it from just looking at the packages I'm afraid :-(
Thanks anyway for the response.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did some work on MicroWebServer.
https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=79225&highlight=microwebserver

It will serve up one page using multiple packets. I am now trying to modify it so that I can serve up two or more different pages depending on what I get back from my outstations. Using uIP.

Possibly worth a look.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks a lot! I will try it
Mat

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just out of curiosity (I haven't played around with any TCP/IP stack on AVR for a long time): Isn't the HTTP protocol sitting on top of the TCP protocol, and doesn't the TCP protocol supply a "network stream" that isolates the application protocol from the division and re-assembly of the stream into IP packets? Or is the application protocol sitting on top of UDP? Or...?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The problem the OP is having comes from the way in which tuxgraphics' web server and TCP/IP stack is implemented. It was designed with a few assumptions intended to simplify the process, which impose restrictions on the implementation - one such restriction is that the interface between the TCP layer and the web server is a single buffer that's exactly one packet in length. They omitted the state machine that would have been needed to deal with breaking up the response into multiple packets and waiting for confirmation and/or potential retransmission of each.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi, I just adapted and tried davef's webserver and it immediately returns a RST and ACK when trying to access with a browser. what am I doing wrong, davef?
Thank you
Mat

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Send me a PM and I'll forward the lastest working code. I think I have just about cracked my problem of serving up optional pages.

In the source (httpd.c) you might find a password (*********), are you using that?

Are you using WireShark?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you. How do I use the password ? Is there supposed to be a prompt or do I have to send it with the address ? Where in the packet can I see how many Parsebytes are necessary ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know how deep you digged into the tcp/ip stack, I just followed the dataflow via UART outputs and just found that in the TCP handling there are no listening connections found and that's why there is a packet with the RST flag sent back. But why ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

On the default page in the browser that comes up you type in <*********> But start with the original code, please.

PARSEBYTES is a #define in httpd.c (at the top)

Didn't dig into the TCP/IP stack at all, except to try and understand how httpd.c and specifically HttpDCall() worked.

So, you have got the original code from the site I provided a link to and loaded it on to a ATmega32 and connected it up to the ENC28J60 board from Futurlec and sorted out the connection error on their board.

What hardware are you running this on?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't even get the default page. I'm running this on a self developed board with a mega1280 and the enc28j60 so I had to do some adaptations. I wanted to concentrate on the webserver first and threw out the other peripherals so there is only left the enc28j60 on the spi now. As I don't get the response I wanted I started digging. I don't know why there is no connection found. As you have seen above the hardware is ok as the other (limited) server ran on it. Maybe I'll have to check the enc28j60 driver...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just to check: You are using the original code and ported it from the ATmeag168 to the ATmega1280 (I haven't a clue about the changes needed).

Mine is ported to the ATmega32. I made one hardware mod to my dev board, pin 13 of the ATmega32 (XTAL1) is connected to CLKO on the Futurlec ENC28J60 mini board. The ATmega32 frequency source is from the ENC28J60 board. Check your PM for a User manual for this board, maybe you are having a hardware problem.