ignore socket error on reuseaddress

This commit is contained in:
Luke Pulverenti 2017-03-29 02:48:05 -04:00
parent 88e3fcfdc7
commit 4f19a7a032

View File

@ -71,10 +71,18 @@ namespace Emby.Common.Implementations.Net
if (remotePort < 0) throw new ArgumentException("remotePort cannot be less than zero.", "remotePort");
var retVal = new Socket(AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp);
try
{
retVal.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
}
catch (SocketException)
{
// This is not supported on all operating systems (qnap)
}
try
{
return new UdpSocket(retVal, new IpEndPointInfo(remoteAddress, remotePort));
}
catch