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 9. Hello Pachube (Sockets Version)

In this chapter, I will present a version of a complete Pachube client that uses the Socket API. It demonstrates that this low-level API is a viable alternative, especially for “fire and forget” requests.

PachubeClient

HelloPachubeSockets (Example 9-1) performs some initializations in its Main method, enters an endless loop in which it waits until it is time for the next measurement, performs the measurement, and then sends the result to Pachube. This is repeated every 20 seconds like in the original HelloPachube program.

Example 9-1. HelloPachubeSockets

using System; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; ...

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