MCPcopy Create free account
hub / github.com/catboost/catboost / GetRemoteAddr

Function GetRemoteAddr

util/network/socket.cpp:250–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248#endif
249
250bool GetRemoteAddr(SOCKET Socket, char* str, socklen_t size) {
251 if (!size) {
252 return false;
253 }
254
255 TOpaqueAddr addr;
256
257 if (getpeername(Socket, addr.MutableAddr(), addr.LenPtr()) != 0) {
258 return false;
259 }
260
261 try {
262 TMemoryOutput out(str, size - 1);
263
264 PrintHost(out, addr);
265 *out.Buf() = 0;
266
267 return true;
268 } catch (...) {
269 // ¯\_(ツ)_/¯
270 }
271
272 return false;
273}
274
275void SetSocketTimeout(SOCKET s, long timeout) {
276 SetSocketTimeout(s, timeout, 0);

Callers 1

RemoteAddrMethod · 0.85

Calls 3

MutableAddrMethod · 0.80
LenPtrMethod · 0.80
BufMethod · 0.45

Tested by

no test coverage detected