#include "config.h"
#endif
#include <boost/program_options.hpp>
+#include <arpa/inet.h>
#include <sys/types.h>
#include <grp.h>
#include <pwd.h>
return;
}
- char buf[4096];
- // Discard the first 2 bytes (qlen)
+ char buf[65535];
int res;
res = recv(cfd, &buf, 2, 0);
if (res != 2) {
}
}
- res = recv(cfd, &buf, sizeof(buf), 0);
+ size_t toRead = std::min(static_cast<size_t>(ntohs((buf[0]<<8) + buf[1])), sizeof(buf));
+ res = recv(cfd, &buf, toRead, 0);
if (res == -1) {
auto savedErrno = errno;