O'Reilly logo

Getting Started with the Internet of Things by Cuno Pfister

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Sending HTTP Requests—The Simple Way

HelloPachube in Chapter 6 is so simple because the Gsiot.PachubeClient library is built for the single purpose of pushing samples to Pachube. It completely hides the .NET classes needed to implement an HTTP client. If you want to use Pachube in a different way, or if you want to write clients for other services, you can use the more general HttpWebRequest and HttpWebResponse classes, which are located in the System.Net namespace.

SimplePutRequest

Example 7-1 shows how these classes can be used to send a single sample to Pachube.

Example 7-1. SimplePutRequest

using System.IO; using System.Net; using System.Text; using Microsoft.SPOT; public class SimplePutRequest { public static void Main() { const string ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required