Index: src/client/c/hu/varadiistvan/xplra/XPlane.cc
===================================================================
--- src/client/c/hu/varadiistvan/xplra/XPlane.cc	(revision 16)
+++ src/client/c/hu/varadiistvan/xplra/XPlane.cc	(revision 17)
@@ -90,4 +90,13 @@
 
 //------------------------------------------------------------------------------
+
+inline void XPlane::checkResult() throw(ProtocolException)
+{
+    uint8_t result = stream->readU8();
+    checkStream();
+    checkResult(result);
+}
+
+//------------------------------------------------------------------------------
 //------------------------------------------------------------------------------
 
@@ -142,7 +151,5 @@
     if (!stream->flush()) checkStream();
 
-    uint8_t result = stream->readU8();
-    checkStream();
-    checkResult(result);
+    checkResult();
 }
 
@@ -285,4 +292,43 @@
 //------------------------------------------------------------------------------
 
+void XPlane::setScalar(const char* name, uint8_t type) throw(Exception)
+{
+    stream->writeU8(Protocol::COMMAND_SET_SINGLE);
+    stream->writeString(name, strlen(name));
+    stream->writeU8(type);
+}
+
+//------------------------------------------------------------------------------
+
+void XPlane::setInt(const char* name, int value) throw(Exception)
+{
+    setScalar(name, Protocol::TYPE_INT);
+    stream->writeS32(value);
+    stream->flush();
+    checkResult();
+}
+
+//------------------------------------------------------------------------------
+
+void XPlane::setFloat(const char* name, float value) throw(Exception)
+{
+    setScalar(name, Protocol::TYPE_FLOAT);
+    stream->writeFloat(value);
+    stream->flush();
+    checkResult();
+}
+
+//------------------------------------------------------------------------------
+
+void XPlane::setDouble(const char* name, double value) throw(Exception)
+{
+    setScalar(name, Protocol::TYPE_DOUBLE);
+    stream->writeDouble(value);
+    stream->flush();
+    checkResult();
+}
+
+//------------------------------------------------------------------------------
+
 // Local Variables:
 // mode: C++
Index: src/client/c/hu/varadiistvan/xplra/XPlane.h
===================================================================
--- src/client/c/hu/varadiistvan/xplra/XPlane.h	(revision 16)
+++ src/client/c/hu/varadiistvan/xplra/XPlane.h	(revision 17)
@@ -183,4 +183,19 @@
     std::string getString(const char* name, size_t offset = 0) throw(Exception);
 
+    /**
+     * Set the given dataref to the given integer value.
+     */
+    void setInt(const char* name, int value) throw(Exception);
+
+    /**
+     * Set the given dataref to the given float value.
+     */
+    void setFloat(const char* name, float value) throw(Exception);
+
+    /**
+     * Set the given dataref to the given double value.
+     */
+    void setDouble(const char* name, double value) throw(Exception);
+
 private:
     /**
@@ -194,4 +209,10 @@
      */
     void checkResult(uint8_t result) throw(ProtocolException);
+
+    /**
+     * Read and check the result.  If it signifies an error,
+     * throw a ProtocolException with the correct error code.
+     */
+    void checkResult() throw(ProtocolException);
 
     /**
@@ -211,4 +232,9 @@
                     ssize_t length, size_t offset) throw(Exception);
 
+
+    /**
+     * Issue the command to set a scalar value of the given type.
+     */
+    void setScalar(const char* name, uint8_t type) throw(Exception);
 };
 
Index: test/basictest.cc
===================================================================
--- test/basictest.cc	(revision 16)
+++ test/basictest.cc	(revision 17)
@@ -133,4 +133,32 @@
         printf("\n\n");
 
+        printf("Setting the number of the engines to %d...\n", numEngines + 1);
+        xplane.setInt("sim/aircraft/engine/acf_num_engines", numEngines + 1);
+        numEngines = xplane.getInt("sim/aircraft/engine/acf_num_engines");
+        printf("The new number of engines: %d\n\n", numEngines);
+
+        float acfElevUp = xplane.getFloat("sim/aircraft/controls/acf_elev_up");
+        printf("Setting the aircraft elevator up control from %f to %f...\n",
+               acfElevUp, acfElevUp + 15.0);
+        xplane.setFloat("sim/aircraft/controls/acf_elev_up", acfElevUp);
+        acfElevUp = xplane.getFloat("sim/aircraft/controls/acf_elev_up");
+        printf("The aircraft elevator up control set to %f\n\n", acfElevUp);
+
+        double acfElevDown = xplane.getDouble("sim/flightmodel/position/local_x");
+        printf("Setting the aircraft elevator down control from %f to %f...\n",
+               acfElevDown, acfElevDown + 15.0);
+        xplane.setDouble("sim/flightmodel/position/local_x", acfElevDown + 15.0);
+        acfElevDown = xplane.getDouble("sim/flightmodel/position/local_x");
+        printf("The aircraft elevator down control set to %f\n\n", acfElevDown);
+
+        try {
+            printf("Querying an invalid dataref...\n");
+            xplane.getInt("sim/aircraft/engine/num_engines");
+            printf("\n>>>>>>>>>>>> Succeeded!!!!!!!!!!!!!!!!!!!!!!\n\n");
+        } catch(const ProtocolException& exception) {
+            printf("Exception caugth: %s\n\n", exception.what());
+        }
+
+
         return 0;
     } catch(const Exception& exception) {
