diff --git a/src/plugins/server/server_socket.ml b/src/plugins/server/server_socket.ml
index 13453b4fb283d1556e6192b922c024795d6251a7..ad9fd893d89a29edf24804133e7420ce37ad730c 100644
--- a/src/plugins/server/server_socket.ml
+++ b/src/plugins/server/server_socket.ml
@@ -118,7 +118,6 @@ let write_data ch data =
     in
     Buffer.add_string ch.bsnd hex ;
     Buffer.add_string ch.bsnd data ;
-    send_bytes ch ;
   end
 
 (* -------------------------------------------------------------------------- *)
@@ -190,7 +189,8 @@ let callback ch rs =
        | data -> write_data ch data
        | exception err ->
          Senv.debug "Socket: encoding error %S@." (Printexc.to_string err)
-    ) rs
+    ) rs ;
+  send_bytes ch
 
 let commands ch =
   begin