Prevent exception on Windows while setting socket options