Fix for pull request #73, it's because 'The TcpListener.Stop method also closes the underlying Socket, and creates a new Socket for the TcpListener. If you set any properties on the underlying Socket prior to calling the Stop method, those properties will not carry over to the new Socket.'
This commit is contained in:
parent
bc4cb2033d
commit
a1373347c6
@ -39,6 +39,9 @@ namespace Example2
|
|||||||
// Not to remove inactive clients periodically
|
// Not to remove inactive clients periodically
|
||||||
//wssv.KeepClean = false;
|
//wssv.KeepClean = false;
|
||||||
|
|
||||||
|
// To resolve to wait for socket in TIME_WAIT state
|
||||||
|
//wssv.ReuseAddress = true;
|
||||||
|
|
||||||
// Adding WebSocket services
|
// Adding WebSocket services
|
||||||
wssv.AddWebSocketService<Echo> ("/Echo");
|
wssv.AddWebSocketService<Echo> ("/Echo");
|
||||||
wssv.AddWebSocketService<Chat> ("/Chat");
|
wssv.AddWebSocketService<Chat> ("/Chat");
|
||||||
|
@ -452,14 +452,9 @@ namespace WebSocketSharp.Server
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value ^ _reuseAddress) {
|
|
||||||
_listener.Server.SetSocketOption (
|
|
||||||
SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, value);
|
|
||||||
|
|
||||||
_reuseAddress = value;
|
_reuseAddress = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the delegate called to find the credentials for an identity used to
|
/// Gets or sets the delegate called to find the credentials for an identity used to
|
||||||
@ -779,6 +774,10 @@ namespace WebSocketSharp.Server
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_reuseAddress)
|
||||||
|
_listener.Server.SetSocketOption (
|
||||||
|
SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
|
||||||
|
|
||||||
_services.Start ();
|
_services.Start ();
|
||||||
_listener.Start ();
|
_listener.Start ();
|
||||||
startReceiving ();
|
startReceiving ();
|
||||||
|
Loading…
Reference in New Issue
Block a user