Index: src/client/c/hu/varadiistvan/xplra/Makefile.am
===================================================================
--- src/client/c/hu/varadiistvan/xplra/Makefile.am	(revision 19)
+++ src/client/c/hu/varadiistvan/xplra/Makefile.am	(revision 21)
@@ -8,4 +8,5 @@
         MultiBuffer.cc  \
         MultiGetter.cc  \
+        MultiSetter.cc  \
         xplra.cc
 
@@ -22,3 +23,4 @@
         MultiBuffer.h   \
         MultiGetter.h   \
+        MultiSetter.h   \
         xplra.h
Index: src/client/c/hu/varadiistvan/xplra/MultiBuffer.cc
===================================================================
--- src/client/c/hu/varadiistvan/xplra/MultiBuffer.cc	(revision 19)
+++ src/client/c/hu/varadiistvan/xplra/MultiBuffer.cc	(revision 21)
@@ -349,4 +349,5 @@
         xplane.stream->writeU8(unregisterCommand);
         xplane.stream->writeU32(static_cast<uint32_t>(registeredID));
+        xplane.stream->flush();
         xplane.checkResult();
         registeredID = -1;
Index: src/client/c/hu/varadiistvan/xplra/MultiSetter.cc
===================================================================
--- src/client/c/hu/varadiistvan/xplra/MultiSetter.cc	(revision 21)
+++ src/client/c/hu/varadiistvan/xplra/MultiSetter.cc	(revision 21)
@@ -0,0 +1,147 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "MultiSetter.h"
+
+#include "XPlane.h"
+
+#include <xplra/Protocol.h>
+
+#include <hu/varadiistvan/scpl/io/DataStream.h>
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::xplra::MultiSetter;
+
+using xplra::Protocol;
+
+using std::vector;
+using std::min;
+
+//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
+
+inline void MultiSetter::write(const DataRef& dataRef) const throw(Exception)
+{
+    switch (dataRef.type) {
+      case Protocol::TYPE_INT:
+        xplane.stream->writeS32(*reinterpret_cast<const int32_t*>
+                                (data + dataRef.dataOffset));
+        break;
+      case Protocol::TYPE_FLOAT:
+        xplane.stream->writeFloat(*reinterpret_cast<const float*>
+                                (data + dataRef.dataOffset));
+        break;
+      case Protocol::TYPE_DOUBLE:
+        xplane.stream->writeDouble(*reinterpret_cast<const double*>
+                                   (data + dataRef.dataOffset));
+        break;
+      case Protocol::TYPE_FLOAT_ARRAY:
+      case Protocol::TYPE_INT_ARRAY:
+      case Protocol::TYPE_BYTE_ARRAY:
+      {
+          size_t elementSize =
+              (dataRef.type==Protocol::TYPE_FLOAT_ARRAY) ? sizeof(float) :
+              ((dataRef.type==Protocol::TYPE_INT_ARRAY) ?
+               sizeof(int32_t) : sizeof(uint8_t));
+          xplane.stream->write(data + dataRef.dataOffset,
+                               dataRef.length * elementSize);
+      }
+    }
+}
+
+//------------------------------------------------------------------------------
+
+uint8_t MultiSetter::doRegister() throw(Exception)
+{
+    // FIXME: only the commands differ from those of MultiGetter
+    xplane.stream->writeU8(Protocol::COMMAND_REGISTER_SET_MULTI);
+    xplane.stream->writeU32(dataRefs.size());
+
+    for(vector<DataRef>::const_iterator i = dataRefs.begin();
+        i!=dataRefs.end(); ++i)
+    {
+        const DataRef& dataRef = *i;
+        xplane.stream->writeString(dataRef.name);
+        xplane.stream->writeU8(dataRef.type);
+        if (dataRef.isArray()) {
+            xplane.stream->writeS32(dataRef.length);
+            xplane.stream->writeS32(dataRef.offset);
+        }
+    }
+
+    return Protocol::COMMAND_UNREGISTER_SET_MULTI;
+}
+
+//------------------------------------------------------------------------------
+
+void MultiSetter::doExecute() throw(Exception)
+{
+    xplane.checkStream();
+    xplane.stream->writeU8(Protocol::COMMAND_EXECUTE_SET_MULTI);
+    xplane.stream->writeU32(registeredID);
+    for(vector<DataRef>::const_iterator i = dataRefs.begin();
+        i!=dataRefs.end(); ++i)
+    {
+        const DataRef& dataRef = *i;
+        write(dataRef);
+    }
+    xplane.stream->flush();
+    xplane.checkResult();
+}
+
+//------------------------------------------------------------------------------
+
+void MultiSetter::doExecuteUnregistered() throw(Exception)
+{
+    for(vector<DataRef>::const_iterator i = dataRefs.begin();
+        i!=dataRefs.end(); ++i)
+    {
+        const DataRef& dataRef = *i;
+        xplane.stream->writeU8(Protocol::COMMAND_SET_SINGLE);
+        xplane.stream->writeString(dataRef.name);
+        xplane.stream->writeU8(dataRef.type);
+        if (dataRef.isArray()) {
+            xplane.stream->writeS32(dataRef.length);
+            xplane.stream->writeS32(dataRef.offset);
+        }
+        write(dataRef);
+        xplane.stream->flush();
+        xplane.checkResult();
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/client/c/hu/varadiistvan/xplra/MultiSetter.h
===================================================================
--- src/client/c/hu/varadiistvan/xplra/MultiSetter.h	(revision 21)
+++ src/client/c/hu/varadiistvan/xplra/MultiSetter.h	(revision 21)
@@ -0,0 +1,96 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef HU_VARADIISTVAN_XPLRA_MULTISETTER_H
+#define HU_VARADIISTVAN_XPLRA_MULTISETTER_H
+//------------------------------------------------------------------------------
+
+#include "MultiBuffer.h"
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace xplra {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A multi-dataref buffer used to set those data.
+ */
+class MultiSetter : public MultiBuffer
+{
+public:
+    /**
+     * Construct the object for the given XPlane instance.
+     */
+    MultiSetter(XPlane& xplane) throw();
+
+protected:
+    /**
+     * @see MultiBuffer::doRegister
+     */
+    virtual uint8_t doRegister() throw(Exception);
+
+    /**
+     * @see MultiBuffer::doExecute
+     */
+    virtual void doExecute() throw(Exception);
+
+    /**
+     * @see MultiBuffer::doExecuteUnregistered
+     */
+    virtual void doExecuteUnregistered() throw(Exception);
+
+private:
+    /**
+     * Write the value of the given dataref from the buffer into the
+     * stream.
+     */
+    void write(const DataRef& dataRef) const throw(Exception);
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline MultiSetter::MultiSetter(XPlane& xplane) throw() :
+    MultiBuffer(xplane)
+{
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::xplra */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_XPLRA_MULTISETTER_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: test/Makefile.am
===================================================================
--- test/Makefile.am	(revision 19)
+++ test/Makefile.am	(revision 21)
@@ -6,5 +6,5 @@
 endif
 
-noinst_PROGRAMS=ctest basictest multigettest
+noinst_PROGRAMS=ctest basictest multigettest multisettest
 
 ctest_SOURCES=ctest.c
@@ -16,2 +16,4 @@
 
 multigettest_SOURCES=multigettest.cc
+
+multisettest_SOURCES=multisettest.cc
Index: test/multisettest.cc
===================================================================
--- test/multisettest.cc	(revision 21)
+++ test/multisettest.cc	(revision 21)
@@ -0,0 +1,119 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of XPLRA, a remote-access plugin for X-Plane
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include <hu/varadiistvan/xplra/XPlane.h>
+#include <hu/varadiistvan/xplra/MultiSetter.h>
+
+#include <hu/varadiistvan/scpl/Thread.h>
+
+#include <cstdio>
+#include <cstring>
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::xplra::XPlane;
+using hu::varadiistvan::xplra::MultiSetter;
+using hu::varadiistvan::xplra::Exception;
+
+using hu::varadiistvan::scpl::Thread;
+
+//------------------------------------------------------------------------------
+
+int main(int argc, char* argv[])
+{
+    bool dontregister = false;
+    for(int i = 1; i<argc; ++i) {
+        if (strcmp(argv[i], "dontregister")==0) {
+            dontregister = true;
+        }
+    }
+
+    try {
+        XPlane xplane;
+
+        printf("Connecting to X-Plane...\n");
+        xplane.connect();
+        printf("Connected to X-Plane.\n\n");
+
+        MultiSetter setter(xplane);
+
+        try {
+            const size_t simSpeedID = setter.addInt("sim/time/sim_speed");
+            const size_t zuluSecID = setter.addFloat("sim/time/zulu_time_sec");
+            const size_t localXID = setter.addDouble("sim/flightmodel/position/local_x");
+            const size_t tailNumID = setter.addByteArray("sim/aircraft/view/acf_tailnum", 40);
+            const size_t generatorOnID = setter.addIntArray("sim/cockpit/electrical/generator_on", 8);
+            const size_t propPitchID = setter.addFloatArray("sim/cockpit2/engine/actuators/prop_pitch_deg", 2);
+
+            if (dontregister) {
+                setter.finalize();
+            } else {
+                printf("Registering getter...\n");
+                setter.registerInXPlane();
+                printf("Registered getter.\n\n");
+            }
+
+            printf("Setting values...\n");
+
+            setter.setInt(simSpeedID, 0);
+            setter.setFloat(zuluSecID, 7265.0);
+            setter.setDouble(localXID, 12.0);
+            setter.setString(tailNumID, "Kukutyin");
+            int32_t generatorOn[8] = { 1, 0, 1, 0, 1, 0, 1, 0 };
+            setter.setIntArray(generatorOnID, generatorOn, 8);
+            float propPitch[2] = { 32.4, 78.2 };
+            setter.setFloatArray(propPitchID, propPitch, 2);
+
+            printf("Executing...\n");
+
+            setter.execute();
+
+            printf("Done.\n");
+
+            return 0;
+        } catch(Exception& exception) {
+            printf("\n>>>>>>>>>>>>>>>>> Exception caugth: %s\n", exception.what());
+
+            return 1;
+        }
+    } catch(Exception& exception) {
+        printf("\n>>>>>>>>>>>>>>>>> Exception caugth: %s\n", exception.what());
+
+        return 1;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
