IUdpServer.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Threading.Tasks;
  3. namespace MediaBrowser.Common.Net
  4. {
  5. /// <summary>
  6. /// Interface IUdpServer
  7. /// </summary>
  8. public interface IUdpServer : IDisposable
  9. {
  10. /// <summary>
  11. /// Occurs when [message received].
  12. /// </summary>
  13. event EventHandler<UdpMessageReceivedEventArgs> MessageReceived;
  14. /// <summary>
  15. /// Starts the specified port.
  16. /// </summary>
  17. /// <param name="port">The port.</param>
  18. void Start(int port);
  19. /// <summary>
  20. /// Stops this instance.
  21. /// </summary>
  22. void Stop();
  23. /// <summary>
  24. /// Sends the async.
  25. /// </summary>
  26. /// <param name="bytes">The bytes.</param>
  27. /// <param name="remoteEndPoint">The remote end point.</param>
  28. /// <returns>Task.</returns>
  29. /// <exception cref="System.ArgumentNullException">data</exception>
  30. Task SendAsync(byte[] bytes, string remoteEndPoint);
  31. /// <summary>
  32. /// Sends the async.
  33. /// </summary>
  34. /// <param name="bytes">The bytes.</param>
  35. /// <param name="ipAddress">The ip address.</param>
  36. /// <param name="port">The port.</param>
  37. /// <returns>Task.</returns>
  38. /// <exception cref="System.ArgumentNullException">bytes</exception>
  39. Task SendAsync(byte[] bytes, string ipAddress, int port);
  40. }
  41. }