Introduce a class to manage the lifetime of a socket - when the object that contains the socket goes out of scope, the underlying socket will be closed.
In addition, the new `Sock` class has a `Send()`, `Recv()` and `Wait()` methods that can be overridden by unit tests to mock the socket operations.
The `Wait()` method also hides the `#ifdef USE_POLL poll() #else select() #endif` technique from higher level code.
This is a backport of [[https://github.com/bitcoin/bitcoin/pull/20788 | core#20788]] [3/5]
https://github.com/bitcoin/bitcoin/pull/20788/commits/ba9d73268f9585d4b9254adcf54708f88222798b
https://github.com/bitcoin/bitcoin/pull/20788/commits/615ba0eb96cf131364c1ceca9d3dedf006fa1e1c
Depends on D11004