kerryjiang / WebSocket4Net

A popular .NET WebSocket Client
752 stars 272 forks source link

When trying to re-open a closed websocket I am getting SocketException "Operation not supported" #100

Open graboszczak opened 6 years ago

graboszczak commented 6 years ago

When trying to re-open a websocket closed by the server I am getting SocketException "Operation not supported".

at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Int32 optionValue) at System.Net.Sockets.Socket.set_ExclusiveAddressUse(Boolean value) at SuperSocket.ClientEngine.ConnectAsyncExtension.ConnectAsync(EndPoint remoteEndPoint, EndPoint localEndPoint, ConnectedCallback callback, Object state)

I am running my code with 0.15.0-beta9 version of your library on a .net core framework on Linux.

FANAT-- commented 6 years ago

@graboszczak, as a workaround, try to clear LocalEndPoint property before re-opening:

websocket.LocalEndPoint = null;
websocket.Open();
graboszczak commented 6 years ago

Thank you.

On Wed, Jul 19, 2017 at 12:47 AM, Павел notifications@github.com wrote:

@graboszczak https://github.com/graboszczak, as a workaround, try to clear LocalEndPoint property before re-opening:

websocket.LocalEndPoint = null;websocket.Open();

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kerryjiang/WebSocket4Net/issues/100#issuecomment-316271667, or mute the thread https://github.com/notifications/unsubscribe-auth/ABblKMelT7iaC28xIn3q-I3jlH977Qz_ks5sPYprgaJpZM4OcLjG .

-- Marcin