MCPcopy Create free account
hub / github.com/chen3feng/toft / DoToString

Method DoToString

system/net/socket_address.cpp:135–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void 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

Callers

nothing calls this directly

Calls 2

assignMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected