This is a piece of #21878, chopped off to ease review.
Peeking at the underlying socket file descriptor of Sock
and checkig if it is INVALID_SOCKET
is bad encapsulation and stands in the way of testing/mocking/fuzzing.
Instead use an empty unique_ptr
to denote that there is no valid socket where appropriate or outright remove such checks where they are not necessary.
The default constructor Sock::Sock()
is unnecessary now after recent changes, thus remove it.