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