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

Test Client in C#

To test your LedController server with a client that runs on a computer, use the test client given in Example 12-4, which sends a PUT request to the server. You need to adapt the constant uri to the address of your device.

The representation sent to the server is contained in constant message. See what happens if you send the value as given below, or if you change it to false or some unsupported value.

Note

This code won’t run on a Netduino Plus. You’ll have to run it on Windows using .NET, or on Mac OS X or Linux using Mono. Mono is an open source implementation of .NET that runs on several platforms.

Example 12-4. LedControllerClient test client in C#

using System; using System.IO; using System.Net; using System.Text; using System.Threading; ...

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