2
0

ISocketFactory.cs 1.7 KB

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