aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Net/NetAcceptSocket.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Net/NetAcceptSocket.cs')
-rw-r--r--Emby.Server.Implementations/Net/NetAcceptSocket.cs98
1 files changed, 0 insertions, 98 deletions
diff --git a/Emby.Server.Implementations/Net/NetAcceptSocket.cs b/Emby.Server.Implementations/Net/NetAcceptSocket.cs
deleted file mode 100644
index d80341a07..000000000
--- a/Emby.Server.Implementations/Net/NetAcceptSocket.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Threading;
-using System.Threading.Tasks;
-using Emby.Server.Implementations.Networking;
-using MediaBrowser.Model.Logging;
-using MediaBrowser.Model.Net;
-
-namespace Emby.Server.Implementations.Net
-{
- public class NetAcceptSocket : IAcceptSocket
- {
- public Socket Socket { get; private set; }
- private readonly ILogger _logger;
-
- public bool DualMode { get; private set; }
-
- public NetAcceptSocket(Socket socket, ILogger logger, bool isDualMode)
- {
- if (socket == null)
- {
- throw new ArgumentNullException("socket");
- }
- if (logger == null)
- {
- throw new ArgumentNullException("logger");
- }
-
- Socket = socket;
- _logger = logger;
- DualMode = isDualMode;
- }
-
- public IpEndPointInfo LocalEndPoint
- {
- get
- {
- return NetworkManager.ToIpEndPointInfo((IPEndPoint)Socket.LocalEndPoint);
- }
- }
-
- public IpEndPointInfo RemoteEndPoint
- {
- get
- {
- return NetworkManager.ToIpEndPointInfo((IPEndPoint)Socket.RemoteEndPoint);
- }
- }
-
- public void Connect(IpEndPointInfo endPoint)
- {
- var nativeEndpoint = NetworkManager.ToIPEndPoint(endPoint);
-
- Socket.Connect(nativeEndpoint);
- }
-
- public void Close()
- {
-#if NET46
- Socket.Close();
-#else
- Socket.Dispose();
-#endif
- }
-
- public void Shutdown(bool both)
- {
- if (both)
- {
- Socket.Shutdown(SocketShutdown.Both);
- }
- else
- {
- // Change interface if ever needed
- throw new NotImplementedException();
- }
- }
-
- public void Listen(int backlog)
- {
- Socket.Listen(backlog);
- }
-
- public void Bind(IpEndPointInfo endpoint)
- {
- var nativeEndpoint = NetworkManager.ToIPEndPoint(endpoint);
-
- Socket.Bind(nativeEndpoint);
- }
-
- public void Dispose()
- {
- Socket.Dispose();
- GC.SuppressFinalize(this);
- }
- }
-}