Reputation: 30138
MS documentations for WinSock says you cant get timeout that you set for socket:
The following table lists value for the optname that represent BSD socket options that are not supported by the getsockopt function.
...
SO_RCVTIMEO int Receives time-out. ...
but I have noticed that lovely .Net has that option:
So is there some ugly way to get it in native code. ?
Upvotes: 0
Views: 404
Reputation: 311039
The first MSDN documentation I found says it is supported. I was using it in Windows twenty years ago. Something severely wrong with your first (uncited) source.
Upvotes: -1
Reputation: 942267
The .NET design is not based on Windows implementation restrictions. There's no magic here, trying to use it anyway will just throw a SocketException, "An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call". A message that comes straight from Windows, WSAENOPROTOOPT winapi error code. But won't when your program runs on Linux, Apple or mobile operating system that does support the option.
So no, the fact that it has the option doesn't promise it will work.
Upvotes: 2