runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Can't disable KeepAlive for ClientWebSocket

Open CC84 opened this issue 10 years ago • 7 comments

I ported a project from .net 4.5 to Core. Building worked fine, but execution with .net Core doesn't work. First of all setting KeepAliveInterval to -1 is no longer supported and throws an OutOfRangeException. Setting it to any other value (e.g. 0) keeps KeepAlive on. I looked at the ClientWebSocket-Code. I suspect KeepAliveInterval is never used. So currently there is no way to modify KeepAlive behavior.

CC84 avatar Dec 27 '15 22:12 CC84

cc: @CIPop

davidsh avatar Dec 27 '15 22:12 davidsh

@CC84 - I think this is expected since ClientWebSocketOptions has not been fully implemented yet. This is tracked by issue dotnet/corefx#5120. @CIPop can confirm.

SidharthNabar avatar Dec 28 '15 18:12 SidharthNabar

Ok, then i'll have to wait. Thx. There even seems to be much more work. When i'm right, currently there is no Unix support at all for the ClientWebSocket. I'm experimenting with an Raspberry... not much fun....

CC84 avatar Dec 28 '15 19:12 CC84

This is actually by design and mirrors the behavior from .Net Desktop (see http://referencesource.microsoft.com/#System/net/System/Net/WebSockets/ClientWebSocket.cs,592).

I'm not sure if this can be controlled on Windows since the implementation is based on WinHTTP. Please open or convert this item to a feature request by changing the title.

Adding behavior-pinning unit/functional tests is still tracked by dotnet/corefx#5120 as @SidharthNabar mentioned.

CIPop avatar Jan 11 '16 21:01 CIPop

@CIPop For WinHTTP, there is a flag WINHTTP_DISABLE_KEEP_ALIVE which can be used with WinHttpQueryOption or WinHttpSetOption.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa384066.aspx

Nyatra avatar May 24 '16 07:05 Nyatra

Thanks @wulf2468 I have reactivated this issue and changed the type.

CIPop avatar May 24 '16 18:05 CIPop

Let's actually track this in one place: dotnet/corefx#5120.

CIPop avatar Jun 02 '16 19:06 CIPop