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 << ("
config file
");servidor << ("
value1= 12345
");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 << ("<input type='button' value='Descarga' onClick=window.location.href='config.txt'>");
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,