update socket interfaces

This commit is contained in:
Luke Pulverenti
2017-03-02 15:50:09 -05:00
parent 9f7ee6d34c
commit 9776ca09db
209 changed files with 565 additions and 12071 deletions

View File

@@ -14,7 +14,7 @@ namespace Emby.Common.Implementations.Net
// THIS IS A LINKED FILE - SHARED AMONGST MULTIPLE PLATFORMS
// Be careful to check any changes compile and work for all platform projects it is shared in.
internal sealed class UdpSocket : DisposableManagedObjectBase, IUdpSocket
internal sealed class UdpSocket : DisposableManagedObjectBase, ISocket
{
#region Fields
@@ -23,8 +23,6 @@ namespace Emby.Common.Implementations.Net
private int _LocalPort;
#endregion
#region Constructors
public UdpSocket(Socket socket, int localPort, IPAddress ip)
{
if (socket == null) throw new ArgumentNullException("socket");
@@ -36,7 +34,13 @@ namespace Emby.Common.Implementations.Net
_Socket.Bind(new IPEndPoint(ip, _LocalPort));
}
#endregion
public UdpSocket(Socket socket, IpEndPointInfo endPoint)
{
if (socket == null) throw new ArgumentNullException("socket");
_Socket = socket;
_Socket.Connect(NetworkManager.ToIPEndPoint(endPoint));
}
public IpAddressInfo LocalIPAddress
{
@@ -44,9 +48,9 @@ namespace Emby.Common.Implementations.Net
private set;
}
#region IUdpSocket Members
#region ISocket Members
public Task<SocketReceiveResult> ReceiveAsync()
public Task<SocketReceiveResult> ReceiveAsync(CancellationToken cancellationToken)
{
ThrowIfDisposed();