Add guards to getsockopt and setsockopt specs.

Add platform guards for different linger specs as linger struct
is not defined in the same way on unixes and windows.