I think this puts it into one thing so it goes as a single packet ... this is probably not neccessary and should be undood
1 files changed, 10 insertions(+), 4 deletions(-)

M gorcon.go
M gorcon.go +10 -4
@@ 3,8 3,8 @@ package gorcon
 import "encoding/binary"
 import "fmt"
 import "io"
+import "bytes"
 import "log"
-import "net"
 
 var _ = fmt.Println
 var _ = log.Println

          
@@ 38,12 38,18 @@ func WriteCommand(w io.Writer, cmdtype C
         Id: int32(0),
         Type: int32(cmdtype),
     }
-    if err := binary.Write(w, binary.LittleEndian, p); err != nil {
+    // TODO is this buffer shit neccessary?
+    var buf bytes.Buffer
+    if err := binary.Write(&buf, binary.LittleEndian, p); err != nil {
         return err
     }
-    if _, err := w.Write(body); err != nil {
+    if _, err := buf.Write(body); err != nil {
         return err
     }
     // 16 bits here since []byte doesn't add a terminal character
-    return binary.Write(w, binary.LittleEndian, int16(0))
+    if err := binary.Write(&buf, binary.LittleEndian, int16(0)); err != nil {
+        return err
+    }
+    _, err := io.Copy(w, &buf)
+    return err
 }