Listener.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using SuperSocket.SocketBase.Config;
  6. using System.Configuration;
  7. using SuperSocket.Common;
  8. namespace SuperSocket.SocketEngine.Configuration
  9. {
  10. /// <summary>
  11. /// Listener configuration
  12. /// </summary>
  13. public class Listener : ConfigurationElement, IListenerConfig
  14. {
  15. /// <summary>
  16. /// Gets the ip of listener
  17. /// </summary>
  18. [ConfigurationProperty("ip", IsRequired = true)]
  19. public string Ip
  20. {
  21. get { return this["ip"] as string; }
  22. }
  23. /// <summary>
  24. /// Gets the port of listener
  25. /// </summary>
  26. [ConfigurationProperty("port", IsRequired = true)]
  27. public int Port
  28. {
  29. get { return (int)this["port"]; }
  30. }
  31. /// <summary>
  32. /// Gets the backlog.
  33. /// </summary>
  34. [ConfigurationProperty("backlog", IsRequired = false, DefaultValue = 100)]
  35. public int Backlog
  36. {
  37. get { return (int)this["backlog"]; }
  38. }
  39. /// <summary>
  40. /// Gets the security option, None/Default/Tls/Ssl/...
  41. /// </summary>
  42. [ConfigurationProperty("security", IsRequired = false)]
  43. public string Security
  44. {
  45. get
  46. {
  47. return (string)this["security"];
  48. }
  49. }
  50. }
  51. /// <summary>
  52. /// Listener configuration collection
  53. /// </summary>
  54. [ConfigurationCollection(typeof(Listener))]
  55. public class ListenerConfigCollection : GenericConfigurationElementCollectionBase<Listener, IListenerConfig>
  56. {
  57. }
  58. }