GH-101100: Fix reference warnings for ``socket`` methods (#110114)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
3 files changed