Call this method to write buf to socket connection established with daemon. Example of
implementation: return write(fd, buf.data(), buf.size());
buf - data that needs to be written to socket
Returns bytes actually transferred or -1 in case of error.
See readFromDaemon() to find out why const std::string &buf is used instead of traditional
(const void *buf, size_t len) arguments.