IActiveConnector.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Net;
  7. namespace SuperSocket.SocketBase
  8. {
  9. /// <summary>
  10. /// Active connect result model
  11. /// </summary>
  12. public class ActiveConnectResult
  13. {
  14. /// <summary>
  15. /// Gets or sets a value indicating whether the conecting is sucessfull
  16. /// </summary>
  17. /// <value>
  18. /// <c>true</c> if result; otherwise, <c>false</c>.
  19. /// </value>
  20. public bool Result { get; set; }
  21. /// <summary>
  22. /// Gets or sets the connected session.
  23. /// </summary>
  24. /// <value>
  25. /// The connected session.
  26. /// </value>
  27. public IAppSession Session { get; set; }
  28. }
  29. /// <summary>
  30. /// The inerface to connect the remote endpoint actively
  31. /// </summary>
  32. public interface IActiveConnector
  33. {
  34. /// <summary>
  35. /// Connect the target endpoint actively.
  36. /// </summary>
  37. /// <param name="targetEndPoint">The target end point.</param>
  38. /// <returns></returns>
  39. Task<ActiveConnectResult> ActiveConnect(EndPoint targetEndPoint);
  40. /// <summary>
  41. /// Connect the target endpoint actively.
  42. /// </summary>
  43. /// <param name="targetEndPoint">The target end point.</param>
  44. /// <param name="localEndPoint">The local end point.</param>
  45. /// <returns></returns>
  46. Task<ActiveConnectResult> ActiveConnect(EndPoint targetEndPoint, EndPoint localEndPoint);
  47. }
  48. }