-# the following is equivalent to rwrite(FERROR, $msg)
-# message header: length 17; MPLEX_BASE + code FERROR
-echo -ne "$(byte_escape ${#msg})\\000\\000\\010"
-# data
-echo -n "$msg"
+# The following is equivalent to rprintf(FERROR_XFER, "%s\n", $msg).
+# 1. Message header: ((MPLEX_BASE + FERROR_XFER) << 24) + $msglen.
+echo -ne "$(byte_escape $msglen)\\000\\000\\010"
+# 2. The actual data.
+echo -E "$msg"
+
+# Make sure the client gets our message, not a write failure.
+sleep 1