Go Down

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

oldman85

Hi,

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: 192.168.1.127");   
        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   192.168.1.253   192.168.1.127   TCP   4904 > http [SYN] Seq=0 Win=65535 Len=0 MSS=1460 SACK_PERM=1
2   0.000138   192.168.1.127   192.168.1.253   TCP   http > 4904 [SYN, ACK] Seq=0 Ack=1 Win=2048 Len=0 MSS=1460
3   0.000158   192.168.1.253   192.168.1.127   TCP   4904 > http [ACK] Seq=1 Ack=1 Win=65535 Len=0
4   0.000325   192.168.1.253   192.168.1.127   HTTP   GET /config.txt HTTP/1.1

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

This is the answer of a good server:
5   0.446897   192.168.1.127   192.168.1.253   TCP   http > 4904 [ACK] Seq=1 Ack=406 Win=6432 Len=0
6   0.031203   192.168.1.127   192.168.1.253   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?


Thanks,


atkam

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

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

br
atkam

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy