The system.http assembly adds roughly 40K to the size of an application download. The NetMF toolbox has an HTTP client implementation which should significantly reduce the size of the download.
For my first proof of concept attempt, I downloaded the latest version of the NetMF toolbox (21733) and
- Removed system.http reference
- Added Toolbox.NETMF.NET.HTTP_Client (4.2)
- AddedToolbox.NETMF.NET.Core (4.2)
- Added Toolbox.NETMF.NET.Integrated (4.2)
- Added Toolbox.NETMF.Core (4.2)
- Modified code to use HTTP_Client instead of HttpWebRequest
The standard NetMF Toolbox HTTP_Client didn’t support adding HTTP headers to a request so I modified HTTP_Client.cs adding my code in the style of the cookies implementation. After a look at the HTTP request generation code I was interested to see what the performance of the NetMF Toolbox HTTP client was compared to the Microsoft one with my payload reducing tweaks.
1122, 1175, 1200, 1169, 1162, 1153, 1150, 1262, 1171, 1152
Average 1171 mSec
Which was a bit slower than I expected
I then hacked the HTTP client code so I could use Fiddler to inspect the request & response payloads
Request Bytes Sent:351
POST http://gpstrackerhttpheaders.cloudapp.net/posV4.aspx HTTP/1.1
User-Agent: NETMFToolbox/0.1 (textmode; Netduino; IntegratedSocket; HTTP_Client)
x-Pos: 5C-86-4A-00-3F-63 20000101025524 F -43.00000 172.00000 25.2 0.80 0 0
HTTP/1.1 200 OK
Date: Tue, 29 Jan 2013 02:55:25 GMT
The downloaded went from 57K to 25k which is roughly a 32K reduction in size. The HTTP Request was a bit more chunky at 351 chars vs. 192 chars, but in a future post I’ll look into reducing it.