From 9776ca09db59a1e382045a072813a29cf07cadb3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 2 Mar 2017 15:50:09 -0500 Subject: update socket interfaces --- Emby.Common.Implementations/Net/NetSocket.cs | 97 ---------------------------- 1 file changed, 97 deletions(-) delete mode 100644 Emby.Common.Implementations/Net/NetSocket.cs (limited to 'Emby.Common.Implementations/Net/NetSocket.cs') diff --git a/Emby.Common.Implementations/Net/NetSocket.cs b/Emby.Common.Implementations/Net/NetSocket.cs deleted file mode 100644 index bc012dfe2..000000000 --- a/Emby.Common.Implementations/Net/NetSocket.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Net; -using System.Net.Sockets; -using System.Threading; -using Emby.Common.Implementations.Networking; -using MediaBrowser.Model.Net; -using MediaBrowser.Model.Logging; - -namespace Emby.Common.Implementations.Net -{ - public class NetSocket : ISocket - { - public Socket Socket { get; private set; } - private readonly ILogger _logger; - - public bool DualMode { get; private set; } - - public NetSocket(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 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); - } - - private SocketAcceptor _acceptor; - public void StartAccept(Action onAccept, Func isClosed) - { - _acceptor = new SocketAcceptor(_logger, Socket, onAccept, isClosed, DualMode); - - _acceptor.StartAccept(); - } - - public void Dispose() - { - Socket.Dispose(); - } - } -} -- cgit v1.2.3