ISocketFactory.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 
  2. namespace MediaBrowser.Model.Net
  3. {
  4. /// <summary>
  5. /// Implemented by components that can create a platform specific UDP socket implementation, and wrap it in the cross platform <see cref="IUdpSocket"/> interface.
  6. /// </summary>
  7. public interface ISocketFactory
  8. {
  9. /// <summary>
  10. /// Createa a new unicast socket using the specified local port number.
  11. /// </summary>
  12. /// <param name="localPort">The local port to bind to.</param>
  13. /// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
  14. IUdpSocket CreateUdpSocket(int localPort);
  15. /// <summary>
  16. /// Createa a new unicast socket using the specified local port number.
  17. /// </summary>
  18. IUdpSocket CreateSsdpUdpSocket(IpAddressInfo localIp, int localPort);
  19. /// <summary>
  20. /// Createa a new multicast socket using the specified multicast IP address, multicast time to live and local port.
  21. /// </summary>
  22. /// <param name="ipAddress">The multicast IP address to bind to.</param>
  23. /// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
  24. /// <param name="localPort">The local port to bind to.</param>
  25. /// <returns>A <see cref="IUdpSocket"/> implementation.</returns>
  26. IUdpSocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
  27. ISocket CreateSocket(IpAddressFamily family, SocketType socketType, ProtocolType protocolType, bool dualMode);
  28. }
  29. public enum SocketType
  30. {
  31. Stream
  32. }
  33. public enum ProtocolType
  34. {
  35. Tcp
  36. }
  37. }