DontLinger Dont work

  • Thread starter Thread starter L.J.SONG
  • Start date Start date
L

L.J.SONG

Hi
Anybody had ever used this statement?
/////
SetSocketOption(SocketOptionLevel.Socket,SocketOptionName,DontLinger,new
LingerOption(false,0))
////

Whernver I use this will got a excption only has a message read
"OptionValue"
 
L.J.SONG said:
Anybody had ever used this statement?
/////
SetSocketOption(SocketOptionLevel.Socket,SocketOptionName,DontLinger,new
LingerOption(false,0))
////

Whernver I use this will got a excption only has a message read
"OptionValue"

I would expect DontLinger to *not* take a LingerOption. Try passing
null instead, or use the version which takes an integer (passing 1, I
presume). I'd expect SocketOptionName.Linger to take a LingerOption
value.
 
Thanks ,
I think so,DontLinger not take a LingerOption
but the follow is come from msdn

/*
To set the DontLinger socket option to false, create a LingerOption, set
the enabled property to false, and set the LingerTime property to the
desired time out period. Use this LingerOption along with the DontLinger
socket option to call the SetSocketOption method.
*/
Maybe document error?
 
L.J.SONG said:
I think so,DontLinger not take a LingerOption
but the follow is come from msdn

/*
To set the DontLinger socket option to false, create a LingerOption, set
the enabled property to false, and set the LingerTime property to the
desired time out period. Use this LingerOption along with the DontLinger
socket option to call the SetSocketOption method.
*/
Maybe document error?

Hmmm... yes, could be. Sorry, I didn't see that before.

It strikes me as slightly odd that there are two different options,
DontLinger and Linger, to be honest - I'd have thought they could have
got away with one option including the "enable or disable" flag in the
option's value.
 
Back
Top