| 133 | } |
| 134 | |
| 135 | void SocketAddressInet4::DoToString(std::string* str) const |
| 136 | { |
| 137 | char text[INET_ADDRSTRLEN + sizeof(":65536")]; |
| 138 | const unsigned char* p = reinterpret_cast<const unsigned char*>(&m_address.sin_addr); |
| 139 | int length = snprintf( |
| 140 | text, sizeof(text), "%u.%u.%u.%u:%d", |
| 141 | p[0], p[1], p[2], p[3], ntohs(m_address.sin_port) |
| 142 | ); |
| 143 | str->assign(text, length); |
| 144 | } |
| 145 | |
| 146 | ///////////////////////////////////////////////////////////////////////////// |
| 147 | // Socket address encapsulation for IPv6 |