INATSocketClient.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Threading.Tasks;
  3. using TouchSocket.Core;
  4. namespace TouchSocket.Sockets
  5. {
  6. /// <summary>
  7. /// INATSocketClient
  8. /// </summary>
  9. public interface INATSocketClient : ISocketClient
  10. {
  11. /// <summary>
  12. /// 添加转发客户端。
  13. /// </summary>
  14. /// <param name="config">配置文件</param>
  15. /// <param name="setupAction">当完成配置,但是还未连接时回调。</param>
  16. /// <returns></returns>
  17. ITcpClient AddTargetClient(TouchSocketConfig config, Action<ITcpClient> setupAction = null);
  18. /// <summary>
  19. /// 添加转发客户端。
  20. /// </summary>
  21. /// <param name="config">配置文件</param>
  22. /// <param name="setupAction">当完成配置,但是还未连接时回调。</param>
  23. /// <returns></returns>
  24. Task<ITcpClient> AddTargetClientAsync(TouchSocketConfig config, Action<ITcpClient> setupAction = null);
  25. /// <summary>
  26. /// 获取所有目标客户端
  27. /// </summary>
  28. /// <returns></returns>
  29. ITcpClient[] GetTargetClients();
  30. /// <summary>
  31. /// 发送数据到全部转发端。
  32. /// </summary>
  33. /// <param name="buffer"></param>
  34. /// <param name="offset"></param>
  35. /// <param name="length"></param>
  36. void SendToTargetClient(byte[] buffer, int offset, int length);
  37. }
  38. }