IUdpSocket.cs 913 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Rssdp.Infrastructure
  7. {
  8. /// <summary>
  9. /// Provides a common interface across platforms for UDP sockets used by this SSDP implementation.
  10. /// </summary>
  11. public interface IUdpSocket : IDisposable
  12. {
  13. /// <summary>
  14. /// Waits for and returns the next UDP message sent to this socket (uni or multicast).
  15. /// </summary>
  16. /// <returns></returns>
  17. System.Threading.Tasks.Task<ReceivedUdpData> ReceiveAsync();
  18. /// <summary>
  19. /// Sends a UDP message to a particular end point (uni or multicast).
  20. /// </summary>
  21. /// <param name="messageData">The data to send.</param>
  22. /// <param name="endPoint">The <see cref="UdpEndPoint"/> providing the address and port to send to.</param>
  23. Task SendTo(byte[] messageData, UdpEndPoint endPoint);
  24. }
  25. }