aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-03-29 02:48:05 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-03-29 02:48:05 -0400
commit4f19a7a032aadf8dec84cdb7075380734647fb73 (patch)
tree4610c6176cd13af99a9a8ad07f39abd82284fce4
parent88e3fcfdc78fcab201fad72466bf2aa50b453210 (diff)
ignore socket error on reuseaddress
-rw-r--r--Emby.Common.Implementations/Net/SocketFactory.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/Emby.Common.Implementations/Net/SocketFactory.cs b/Emby.Common.Implementations/Net/SocketFactory.cs
index 1fd367afb..5169c5a21 100644
--- a/Emby.Common.Implementations/Net/SocketFactory.cs
+++ b/Emby.Common.Implementations/Net/SocketFactory.cs
@@ -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