Fix: use getsockname instead of getsockopt to get socket family

Seems that OS X 10.10 Yosemite does not support the SO_DOMAIN anymore so
use a known compatible call to get the socket family in recv(2).

Fixes #13571

Signed-off-by: David Goulet <dgoulet@ev0ke.net>