Skip to content

Commit

Permalink
Always set ReuseAddress (#294)
Browse files Browse the repository at this point in the history
Fixes #292
  • Loading branch information
xPaw committed Jun 2, 2020
1 parent 9683310 commit d763451
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Fleck/WebSocketServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit d763451

Please sign in to comment.