+void flushbuf()
+{
+ if (nwrite)
+ {
+ write(sfd, writbuf, nwrite);
+ nwrite = 0;
+ }
+}
+
+void sendbuf(int len)
+{
+ if (!standalone)
+ {
+ realbuf[0] = realbuf[1] = realbuf[2] = 0;
+ realbuf[3] = (unsigned char)len;
+ buf[0] = 0;
+ if (nwrite + 4 + len >= BUFLEN)
+ fatal("Internal error: send buffer overflow");
+ memcpy(writbuf + nwrite, realbuf, 4 + len);
+ nwrite += 4 + len;
+ }
+}
+