Use the appropriate sock opt for linux
Fix compile error on windows