Go Down

Topic: download config from webserver, emulate a server? (Read 803 times) previous topic - next topic



I use a webserver on arduino to config a control system. I upload a config file to commissioning the system and it works Ok. Now i will like to download the configuration to a file if i change the default upload values. All the config values are on eprom, not use SD card.

I can not use this because the browser is not a server:
        servidor << ("GET config.txt HTTP/1.1 \nHost:");   
        servidor << ("\nContent-Type: text/csv\nContent-Length: 21");
        servidor << ("\n\n");
        servidor << ("list of config values");

I donĀ“t want to copy the screen sending samething like this:
        servidor << ("<p> config file </p>");
        servidor << ("<p> value1= 12345</p>");         

I have tried use wireshark and download page to emulate the procedure but i have not a file system on the arduino them code like this does not works without an server emulation:
        servidor << ("<form><input type='button' value='Descarga' onClick=window.location.href='config.txt'></form>");

Then i think i can emulate the server with a file system answer but i don`t know how to send the ACK and the data.

This is the request of the form sniffed (253=PC):
1   0.000000   TCP   4904 > http [SYN] Seq=0 Win=65535 Len=0 MSS=1460 SACK_PERM=1
2   0.000138   TCP   http > 4904 [SYN, ACK] Seq=0 Ack=1 Win=2048 Len=0 MSS=1460
3   0.000158   TCP   4904 > http [ACK] Seq=1 Ack=1 Win=65535 Len=0
4   0.000325   HTTP   GET /config.txt HTTP/1.1

This is my wrong arduino answer:
5   0.031203   HTTP   Continuation or non-HTTP traffic

This is the answer of a good server:
5   0.446897   TCP   http > 4904 [ACK] Seq=1 Ack=406 Win=6432 Len=0
6   0.031203   TCP   [TCP segment of a reassembled PDU]

The ACK (5) i don't know how to send it.

I think the (6) could be some like this:

  servidor << ("HTTP/1.0 200 OK\x0d\x0a Accept-Ranges: bytes\x0d\x0a Content-Length: 100\x0d\x0a Content-type:   application/zip\x0d\x0a Connection: Keep-alive\x0d\x0a\x0d\x0a");
  servidor << ("config.txt");
  servidor << (values);

Any idea?

Does any body knows the frame i need to send to the browser to follow the protocol?



I have a exact the same problem.  Anyone already solve this problem?
I use:

Arduino 1.0.3
Arduino uno R3
Library: GSMSHIELD (GSM.cpp, ...)
3049   542.613398   TCP   15271 > http [ACK] Seq=333 Ack=1849 Win=65199 Len=0
2939   504.662185   HTTP   Continuation or non-HTTP traffic


Go Up