tqchen commented on a change in pull request #4281: [RUTNIME] Support C++ RPC URL: https://github.com/apache/incubator-tvm/pull/4281#discussion_r344291688
########## File path: src/common/socket.h ########## @@ -62,6 +65,25 @@ inline std::string GetHostName() { return std::string(buf.c_str()); } +/*! + * \brief ValidateIP validates an ip address. + * \param ip The ip address in string format localhost or x.x.x.x format + * \return result of operation. + */ +inline bool ValidateIP(std::string ip) { + if (ip == "localhost") { + return true; + } + std::vector<std::string> list = Split(ip, '.'); + if (list.size() != 4) Review comment: Ideally, we should just use std::istringstream to do the validation(to reduce memory complexity). Given that this is a util function, we would like to apply such higher standard ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services