| 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); |
no test coverage detected