// get reply from server. Caller must free buf // int RPC_CLIENT::get_reply(char*& mbuf) { char buf[8193]; MFILE mf; int n; while (1) { n = recv(sock, buf, 8192, 0); if (n <= 0) return ERR_READ; buf[n]=0; mf.puts(buf); if (strchr(buf, '\003')) break; } mf.get_buf(mbuf, n); return 0; }
/// Get reply from server. /// Caller must free the buffer. /// /// \param[in,out] mbuf Reference to a pointer which will point to the /// string received from the rpc-server. /// \return Zero on success, ERR_READ on error. int RPC_CLIENT::get_reply(char*& mbuf) { MFILE mf; int n; while (true) { char buf[8193]; n = recv(sock, buf, sizeof(buf) - 1, 0); if (n <= 0) { return ERR_READ; } buf[n]=0; mf.puts(buf); if (strchr(buf, '\003')) { break; } } mf.get_buf(mbuf, n); return 0; }