Index: misc/client.py
===================================================================
--- misc/client.py	(revision 6)
+++ misc/client.py	(revision 7)
@@ -16,5 +16,25 @@
                "fa" : 0x11,
                "ia" : 0x12,
-               "ba" : 0x13 }
+               "ba" : 0x13,
+               "s"  : 0x13 }
+
+    @staticmethod
+    def _splitArgs(args):
+        """Split the given argument string into a list of words."""
+        words = []
+        word = ""
+        inQuote = False
+        for c in args:
+            if c.isspace() and not inQuote:
+                if word:
+                    words.append(word)
+                    word = ""
+            elif c=="\"" and (not word or inQuote):
+                inQuote = not inQuote
+            else:
+                word += c
+        if word:
+            words.append(word)
+        return words
 
     @staticmethod
@@ -57,5 +77,5 @@
     def do_get(self, args):
         """Handle the 'get' command"""
-        words = args.split()
+        words = self._splitArgs(args)
         if len(words)<2:
             print >> sys.stderr, "Missing parameters"
@@ -85,32 +105,43 @@
         result = self._readU8()
         if result==0:
-            value = None
-            if type=="i":
-                value = self._readS32()
-            elif type=="f":
-                value = self._readFloat()
-            elif type=="d":
-                value = self._readDouble()
-            elif type=="fa":
-                length = self._readS32()
-                if length>0:
-                    value = [self._readFloat() for i in range(0, length)]
-            elif type=="ia":
-                length = self._readS32()
-                if length>0:
-                    value = [self._readS32() for i in range(0, length)]
-            elif type=="ba":
-                length = self._readS32()
-                if length>0:
-                    bytes = [self._readU8() for i in range(0, length)]
-                    value = ""
-                    for b in bytes:
-                        if b==0: break
-                        value += chr(b)
-                    #value = bytes
-
-            print value
+            print self._readValue(type)
         else:
-            print "Result code:", result
+            print "Error code:", result
+
+    def do_set(self, args):
+        """Handle the 'set' command"""
+        words = self._splitArgs(args)
+        if len(words)<3:
+            print >> sys.stderr, "Missing parameters"
+            return False
+
+        name = words[0]
+
+        type = words[1]
+        if type not in self._types:
+            print >> sys.stderr, "Invalid type"
+            return False
+
+        value = words[2]
+
+        length = None
+        offset = None
+        if len(words)>4:
+            length = int(words[3])
+            offset = int(words[4])
+
+        self._writeU8(0x02)
+        self._writeString(name)
+        self._writeU8(self._types[type])
+        if length is not None:
+            self._writeS32(length)
+            self._writeS32(offset)
+        self._writeValue(type, value, length)
+
+        self._flush()
+
+        result = self._readU8()
+        if result!=0:
+            print "Error code:", result
 
     def _writeU8(self, x):
@@ -121,4 +152,12 @@
         """Write the given value as a signed, 32-bit value."""
         self._stream.write(struct.pack("i", x))
+
+    def _writeFloat(self, x):
+        """Write the given value as a single-precision floating point."""
+        self._stream.write(struct.pack("f", x))
+
+    def _writeDouble(self, x):
+        """Write the given value as a double-precision floating point."""
+        self._stream.write(struct.pack("d", x))
 
     def _writeLength(self, length):
@@ -164,5 +203,4 @@
                 return length
 
-    @staticmethod
     def _readString(self):
         """Read a string from our stream."""
@@ -170,4 +208,64 @@
         return self._stream.read(length)
 
+    def _readValue(self, type):
+        """Read the value of the given type from the stream."""
+        if type=="i":
+            return self._readS32()
+        elif type=="f":
+            return self._readFloat()
+        elif type=="d":
+            return self._readDouble()
+        elif type in ["fa", "ia", "ba", "s"]:
+            length = self._readS32()
+            if length>8192:
+                print "Very big length:", length
+                return None
+            elif length>0:
+                if type=="fa":
+                    return [self._readFloat() for i in range(0, length)]
+                elif type=="ia":
+                    return [self._readS32() for i in range(0, length)]
+                elif type=="ba" or type=="s":
+                    bytes = [self._readU8() for i in range(0, length)]
+                    if type=="ba":
+                        return bytes
+                    else:
+                        string = ""
+                        for b in bytes:
+                            if b==0: break
+                            string += chr(b)
+                        return string
+            elif length==0:
+                return []
+            else:
+                return None
+
+    def _writeValue(self, type, value, length = None):
+        """Write the given value of the given type to the stream."""
+        if type=="i":
+            self._writeS32(int(value))
+        elif type=="f":
+            self._writeFloat(float(value))
+        elif type=="d":
+            self._writeDouble(float(value))
+        elif type in ["fa", "ia", "ba", "s"]:
+            if type=="s":
+                values = [ord(c) for c in value]
+            else:
+                words = [word.strip() for word in value.split(",")]
+                values = [float(word) if type=="fa" else int(word)
+                          for word in words]
+            if len(values)<length:
+                values += [0.0 if type=="fa" else 0] * (length-len(values))
+            elif len(values)>length:
+                values = values[:length]
+            for value in values:
+                if type=="fa":
+                    self._writeFloat(value)
+                elif type=="ia":
+                    self._writeS32(value)
+                else:
+                    self._writeU8(value)
+
 #------------------------------------------------------------------------------
 
Index: misc/test1.sh
===================================================================
--- misc/test1.sh	(revision 6)
+++ misc/test1.sh	(revision 7)
@@ -11,5 +11,5 @@
 get sim/flightmodel/position/latitude d
 get sim/flightmodel/position/longitude d
-get sim/aircraft/view/acf_descrip ba -1 0
+get sim/aircraft/view/acf_descrip s -1 0
 get sim/aircraft/prop/acf_en_type ia -1 0
 get sim/aircraft/prop/acf_prop_dir fa -1 0
Index: misc/test2.sh
===================================================================
--- misc/test2.sh	(revision 7)
+++ misc/test2.sh	(revision 7)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+scriptdir=`dirname $0`
+
+"${scriptdir}/client.py" <<EOF
+set sim/aircraft/engine/acf_num_engines i 3
+get sim/aircraft/engine/acf_num_engines i
+set sim/aircraft/controls/acf_elev_up f 100.0
+get sim/aircraft/controls/acf_elev_up f
+set sim/aircraft/view/acf_tailnum s HA-VAI 40 0
+get sim/aircraft/view/acf_tailnum s -1 0
+EOF
