diff --git a/src/Fleck/WebSocketServer.cs b/src/Fleck/WebSocketServer.cs index d1e16da4..f8f3e404 100644 --- a/src/Fleck/WebSocketServer.cs +++ b/src/Fleck/WebSocketServer.cs @@ -27,12 +27,13 @@ public WebSocketServer(string location, bool supportDualStack = true) _scheme = uri.Scheme; var socket = new Socket(_locationIP.AddressFamily, SocketType.Stream, ProtocolType.IP); + socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); + if (SupportDualStack) { if (!FleckRuntime.IsRunningOnMono() && FleckRuntime.IsRunningOnWindows()) { socket.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, false); - socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); } }