Index: branches/1.3/gui/scripts/flowvisviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/flowvisviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/flowvisviewer.tcl	(revision 5217)
@@ -108,5 +108,4 @@
     private method EventuallyGoto { nSteps }
     private method EventuallyResizeLegend { }
-    private method FlowCmd { dataobj comp nbytes extents }
     private method GetMovie { widget width height }
     private method GetPngImage { widget width height }
@@ -115,4 +114,5 @@
     private method ParseLevelsOption { tf levels }
     private method ParseMarkersOption { tf markers }
+    private method SendFlowCmd { dataobj comp nbytes extents }
     private method WaitIcon { option widget }
     private method str2millisecs { value }
@@ -670,5 +670,5 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::FlowvisViewer::delete {args} {
-     flow stop
+    flow stop
     if {[llength $args] == 0} {
         set args $_dlist
@@ -1225,14 +1225,11 @@
             # I have a field. Is a vector field or a volume field?
             if { $extents == 1 } {
-                set cmd "volume data follows $nbytes $tag\n"
+                SendCmd "volume data follows $nbytes $tag"
             } else {
-                set cmd [FlowCmd $dataobj $comp $nbytes $extents]
-                if { $cmd == "" } {
-                    puts stderr "no command"
+                if {[SendFlowCmd $dataobj $comp $nbytes $extents] < 0} {
                     continue
                 }
             }
-            append _outbuf $cmd
-            append _outbuf $data
+            SendData $data
             NameTransferFunc $dataobj $comp
             set _recvObjs($tag) 1
@@ -2633,18 +2630,17 @@
 }
 
-itcl::body Rappture::FlowvisViewer::FlowCmd { dataobj comp nbytes extents } {
+itcl::body Rappture::FlowvisViewer::SendFlowCmd { dataobj comp nbytes extents } {
     set tag "$dataobj-$comp"
     if { ![info exists _obj2flow($tag)] } {
-        append cmd "flow add $tag\n"
-        append cmd "$tag data follows $nbytes $extents\n"
-        return $cmd
+        SendCmd "flow add $tag"
+        SendCmd "$tag data follows $nbytes $extents"
+        return 0
     }
     set flowobj $_obj2flow($tag)
     if { $flowobj == "" } {
         puts stderr "no flowobj"
-        return ""
-    }
-    set cmd {}
-    append cmd "if {\[flow exists $tag\]} {flow delete $tag}\n"
+        return -1
+    }
+    SendCmd "if {\[flow exists $tag\]} {flow delete $tag}"
     array set info  [$flowobj hints]
     set _settings($this-volume) $info(volume)
@@ -2653,4 +2649,5 @@
     set _settings($this-duration) $info(duration)
     $itk_component(speed) value $info(speed)
+    set cmd {}
     append cmd "flow add $tag"
     append cmd " -position $info(position)"
@@ -2659,6 +2656,8 @@
     append cmd " -outline $info(outline)"
     append cmd " -slice $info(streams)"
-    append cmd " -arrows $info(arrows)\n"
+    append cmd " -arrows $info(arrows)"
+    SendCmd $cmd
     foreach part [$flowobj particles] {
+        set cmd {}
         array unset info
         array set info $part
@@ -2669,7 +2668,9 @@
         append cmd " -axis $info(axis)"
         append cmd " -color {$color}"
-        append cmd " -size $info(size)\n"
+        append cmd " -size $info(size)"
+        SendCmd $cmd
     }
     foreach box [$flowobj boxes] {
+        set cmd {}
         array unset info
         set info(corner1) ""
@@ -2685,8 +2686,9 @@
         append cmd " -linewidth $info(linewidth) "
         append cmd " -corner1 {$info(corner1)} "
-        append cmd " -corner2 {$info(corner2)}\n"
-    }
-    append cmd "$tag data follows $nbytes $extents\n"
-    return $cmd
+        append cmd " -corner2 {$info(corner2)}"
+        SendCmd $cmd
+    }
+    SendCmd "$tag data follows $nbytes $extents"
+    return 0
 }
 
Index: branches/1.3/gui/scripts/molvisviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/molvisviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/molvisviewer.tcl	(revision 5217)
@@ -966,5 +966,5 @@
                 # with the data payload immediately afterwards.
                 ServerCmd "loadpdb -defer follows $model $state $numBytes"
-                append _outbuf $data1
+                SendData $data1
                 set _dataobjs($model-$state)  1
             }
@@ -979,5 +979,5 @@
                 # with the data payload immediately afterwards.
                 ServerCmd "loadpdb -defer follows $model $state $numBytes"
-                append _outbuf $data2
+                SendData $data2
                 set _dataobjs($model-$state)  1
             }
@@ -1028,5 +1028,5 @@
                     # command with the data payload immediately afterwards.
                     ServerCmd "loadpdb -defer follows $model $state $numBytes"
-                    append _outbuf $data3
+                    SendData $data3
                 }
                 set _dataobjs($model-$state) 1
Index: branches/1.3/gui/scripts/nanovisviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/nanovisviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/nanovisviewer.tcl	(revision 5217)
@@ -920,5 +920,5 @@
                 }
                 SendCmd "volume data follows $nbytes $tag"
-                append _outbuf $data
+                SendData $data
                 set _recvdDatasets($tag) 1
                 set _serverDatasets($tag) 0
Index: branches/1.3/gui/scripts/visviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/visviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/visviewer.tcl	(revision 5217)
@@ -29,4 +29,5 @@
     private common _done            ;   # Used to indicate status of send.
     private variable _buffer        ;   # buffer for incoming/outgoing commands
+    private variable _outbuf       ;    # buffer for outgoing commands
     private variable _blockOnWrite 0;   # Should writes to socket block?
     private variable _initialized
@@ -46,5 +47,4 @@
     protected variable _sid ""      ;   # socket connection to server
     protected variable _maxConnects 100
-    protected variable _outbuf       ;    # buffer for outgoing commands
     protected variable _buffering 0
     protected variable _cmdSeq 0     ;    # Command sequence number
Index: branches/1.3/gui/scripts/vtkglyphviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkglyphviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkglyphviewer.tcl	(revision 5217)
@@ -837,5 +837,4 @@
     $_dispatcher cancel !legend
     # disconnected -- no more data sitting on server
-    set _outbuf ""
     array unset _datasets 
     array unset _data 
@@ -1000,5 +999,5 @@
                 }
                 SendCmd "dataset add $tag data follows $length"
-                append _outbuf $bytes
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
Index: branches/1.3/gui/scripts/vtkheightmapviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkheightmapviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkheightmapviewer.tcl	(revision 5217)
@@ -1002,5 +1002,5 @@
                 }
                 SendCmd "dataset add $tag data follows $length"
-                append _outbuf $bytes
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
Index: branches/1.3/gui/scripts/vtkimageviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkimageviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkimageviewer.tcl	(revision 5217)
@@ -980,5 +980,5 @@
                 }
                 SendCmd "dataset add $tag data follows $length"
-                append _outbuf $bytes
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
Index: branches/1.3/gui/scripts/vtkisosurfaceviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkisosurfaceviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkisosurfaceviewer.tcl	(revision 5217)
@@ -949,5 +949,4 @@
     $_dispatcher cancel !legend
     # disconnected -- no more data sitting on server
-    set _outbuf ""
     array unset _datasets
     array unset _data
@@ -1112,5 +1111,5 @@
                 }
                 SendCmd "dataset add $tag data follows $length"
-                append _outbuf $bytes
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
Index: branches/1.3/gui/scripts/vtkmeshviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkmeshviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkmeshviewer.tcl	(revision 5217)
@@ -867,5 +867,5 @@
             }
             SendCmd "dataset add $tag data follows $length"
-            append _outbuf $bytes
+            SendData $bytes
             set _datasets($tag) 1
             SetObjectStyle $dataobj
Index: branches/1.3/gui/scripts/vtkstreamlinesviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkstreamlinesviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkstreamlinesviewer.tcl	(revision 5217)
@@ -1008,5 +1008,5 @@
                 }
                 SendCmd "dataset add $tag data follows $length"
-                append _outbuf $bytes
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
@@ -2165,5 +2165,5 @@
         set length [string length $seeds]
         SendCmd "streamlines seed fmesh 200 data follows $length $tag"
-        append _outbuf $seeds
+        SendData $seeds
         set _seeds($dataobj) 1
     }
Index: branches/1.3/gui/scripts/vtksurfaceviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtksurfaceviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtksurfaceviewer.tcl	(revision 5217)
@@ -792,5 +792,4 @@
     $_dispatcher cancel !legend
     # disconnected -- no more data sitting on server
-    set _outbuf ""
     array unset _datasets
     array unset _data
@@ -957,5 +956,5 @@
                 }
                 SendCmd "dataset add $tag data follows $length"
-                append _outbuf $bytes
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
Index: branches/1.3/gui/scripts/vtkviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkviewer.tcl	(revision 5217)
@@ -926,5 +926,4 @@
 
     # disconnected -- no more data sitting on server
-    set _outbuf ""
     array unset _datasets
     array unset _data
@@ -1084,5 +1083,5 @@
                 }
                 SendCmd "dataset add $tag data follows $length"
-                append _outbuf $bytes
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
Index: branches/1.3/gui/scripts/vtkvolumeviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkvolumeviewer.tcl	(revision 5216)
+++ branches/1.3/gui/scripts/vtkvolumeviewer.tcl	(revision 5217)
@@ -815,5 +815,4 @@
     $_dispatcher cancel !legend
     # disconnected -- no more data sitting on server
-    set _outbuf ""
     array unset _datasets 
     array unset _data 
@@ -977,6 +976,6 @@
                     SendCmd [list "clientinfo" $info]
                 }
-                append _outbuf "dataset add $tag data follows $length\n"
-                append _outbuf $bytes
+                SendCmd "dataset add $tag data follows $length"
+                SendData $bytes
                 set _datasets($tag) 1
                 SetObjectStyle $dataobj $comp
