ISocketFactory.cs 1.7 KB

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