diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-03-03 00:53:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-03 00:53:47 -0500 |
| commit | 9f8cbc668db3885f2a30ebf5ca62d2e1de3af98f (patch) | |
| tree | 4a9f055e10fa90384d74a635ca535e3de328f9bd /Emby.Common.Implementations/Net/UdpSocket.cs | |
| parent | 8e1c53aaf482ec89df00066ca827239e5dde3346 (diff) | |
| parent | 7cbc76af27637fca10bca21d0b343f96b1a02b6a (diff) | |
Merge pull request #2504 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Common.Implementations/Net/UdpSocket.cs')
| -rw-r--r-- | Emby.Common.Implementations/Net/UdpSocket.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Emby.Common.Implementations/Net/UdpSocket.cs b/Emby.Common.Implementations/Net/UdpSocket.cs index e4b0c7d6d..8e2a1da6f 100644 --- a/Emby.Common.Implementations/Net/UdpSocket.cs +++ b/Emby.Common.Implementations/Net/UdpSocket.cs @@ -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(); |
