Check the return value from setsockopt and log errors

Fixes coverty 700269

Fixes #11611.

Signed-off-by: Paul Harrison <pharrison@mythtv.org>