[MonoTouch] NSUrlConnection vs. System.Net.WebClient

Miguel de Icaza miguel at novell.com
Wed Dec 1 19:43:00 EST 2010


Is there an advantage to using NSUrlConnection for web requests rather than
> System.Net.WebClient? I suspect the former is closer to the metal and
> therefore may be faster on the device, but I also expect network latency to
> dominate the round-trip time for a given web request.

WebClient is just a tiny class that is convenient for quick and dirty jobs.

If you want more control over your HTTP connection, you would use
HttpWebRequest, or NSUrlConnection, both support more advanced uses of HTTP.

The HttpWebRequest in particular has a nice streaming interface, that does
not need to hold all the data in memory, so for large data files, you can
parse/stream as you go and discard results (this is very convenient for Json
or XML parsing, as both can parse-and-forget)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monotouch/attachments/20101201/4f065ca8/attachment-0001.html 

More information about the MonoTouch mailing list