Fix socket get/set timeout for Windows/Cygwin

Fixes: https://bugzilla.osafoundation.org/show_bug.cgi?id=12365