ISocket.cs 953 B

12345678910111213141516171819202122232425262728
  1. #pragma warning disable CS1591
  2. #pragma warning disable SA1600
  3. using System;
  4. using System.Net;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. namespace MediaBrowser.Model.Net
  8. {
  9. /// <summary>
  10. /// Provides a common interface across platforms for UDP sockets used by this SSDP implementation.
  11. /// </summary>
  12. public interface ISocket : IDisposable
  13. {
  14. IPAddress LocalIPAddress { get; }
  15. Task<SocketReceiveResult> ReceiveAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken);
  16. IAsyncResult BeginReceive(byte[] buffer, int offset, int count, AsyncCallback callback);
  17. SocketReceiveResult EndReceive(IAsyncResult result);
  18. /// <summary>
  19. /// Sends a UDP message to a particular end point (uni or multicast).
  20. /// </summary>
  21. Task SendToAsync(byte[] buffer, int offset, int bytes, IPEndPoint endPoint, CancellationToken cancellationToken);
  22. }
  23. }