tqchen commented on a change in pull request #4281: [RUTNIME] Support C++ RPC
URL: https://github.com/apache/incubator-tvm/pull/4281#discussion_r344292628
##########
File path: src/common/socket.h
##########
@@ -468,7 +524,134 @@ class TCPSocket : public Socket {
}
return ndone;
}
+ /*!
+ * \brief Send the data to remote.
+ * \param data The data to be sent.
+ */
+ void SendBytes(std::string data) {
+ int datalen = data.length();
+ CHECK_EQ(SendAll(&datalen, sizeof(datalen)), sizeof(datalen));
+ CHECK_EQ(SendAll(data.c_str(), datalen), datalen);
+ }
+ /*!
+ * \brief Receive the data to remote.
+ * \return The data received.
+ */
+ std::string RecvBytes() {
+ int datalen = 0;
+ CHECK_EQ(RecvAll(&datalen, sizeof(datalen)), sizeof(datalen));
+ std::string data;
+ data.resize(datalen);
+ CHECK_EQ(RecvAll(&data[0], datalen), datalen);
+ return data;
+ }
};
+
+/*! \brief helper data structure to perform select */
+struct SelectHelper {
Review comment:
consider use poll instead
https://github.com/dmlc/rabit/blob/master/include/rabit/internal/socket.h#L441
select has a limit on the descriptor size which poll resolves
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services