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

Function CreateSocket

library/cpp/neh/udp.cpp:325–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323 typedef TVector<TSocketRef> TSockets;
324
325 static inline void CreateSocket(TSocketHolder& s, const IRemoteAddr& addr) {
326 TSocketHolder res(socket(addr.Addr()->sa_family, SOCK_DGRAM, IPPROTO_UDP));
327
328 if (!res) {
329 ythrow TSystemError() << "can not create socket";
330 }
331
332 FixIPv6ListenSocket(res);
333
334 if (bind(res, addr.Addr(), addr.Len()) != 0) {
335 ythrow TBindError() << "can not bind " << PrintHostAndPort(addr);
336 }
337
338 res.Swap(s);
339 }
340
341 static inline void CreateSockets(TSockets& s, ui16 port) {
342 TNetworkAddress addr(port);

Callers 4

CreateSocketsFunction · 0.70
ExecServerThreadMethod · 0.70
StartServerSocketMethod · 0.50
StartClientSocketMethod · 0.50

Calls 4

FixIPv6ListenSocketFunction · 0.85
AddrMethod · 0.45
LenMethod · 0.45
SwapMethod · 0.45

Tested by

no test coverage detected