ISocket.cs 940 B

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