ISocketFactory.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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="ISocket"/> 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="ISocket"/> implementation.</returns>
  14. ISocket CreateUdpSocket(int localPort);
  15. ISocket CreateTcpSocket(IpAddressInfo remoteAddress, int remotePort);
  16. /// <summary>
  17. /// Createa a new unicast socket using the specified local port number.
  18. /// </summary>
  19. ISocket CreateSsdpUdpSocket(IpAddressInfo localIp, int localPort);
  20. /// <summary>
  21. /// Createa a new multicast socket using the specified multicast IP address, multicast time to live and local port.
  22. /// </summary>
  23. /// <param name="ipAddress">The multicast IP address to bind to.</param>
  24. /// <param name="multicastTimeToLive">The multicast time to live value. Actually a maximum number of network hops for UDP packets.</param>
  25. /// <param name="localPort">The local port to bind to.</param>
  26. /// <returns>A <see cref="ISocket"/> implementation.</returns>
  27. ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
  28. IAcceptSocket CreateSocket(IpAddressFamily family, SocketType socketType, ProtocolType protocolType, bool dualMode);
  29. }
  30. public enum SocketType
  31. {
  32. Stream
  33. }
  34. public enum ProtocolType
  35. {
  36. Tcp
  37. }
  38. }