C++, boost: which is fastest way to parse string like tcp://adr:port/ into address string and one int for port?

后端 未结 5 2283
南旧
南旧 2020-12-22 01:31

we have std::string A with tcp://adr:port/ How to parse it into address std::string and one int for port?

5条回答
  •  醉话见心
    2020-12-22 02:21

    Nowadays one may also meet IPv6 addresses with a host part that already contains a variable number of colons and dots. Splitting URL's then should be done following RFC3986. See wikipedia IPv6

提交回复
热议问题