IIDSender.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //------------------------------------------------------------------------------
  2. // 此代码版权(除特别声明或在XREF结尾的命名空间的代码)归作者本人若汝棋茗所有
  3. // 源代码使用协议遵循本仓库的开源协议及附加协议,若本仓库没有设置,则按MIT开源协议授权
  4. // CSDN博客:https://blog.csdn.net/qq_40374647
  5. // 哔哩哔哩视频:https://space.bilibili.com/94253567
  6. // Gitee源代码仓库:https://gitee.com/RRQM_Home
  7. // Github源代码仓库:https://github.com/RRQM
  8. // API首页:https://www.yuque.com/rrqm/touchsocket/index
  9. // 交流QQ群:234762506
  10. // 感谢您的下载和使用
  11. //------------------------------------------------------------------------------
  12. //------------------------------------------------------------------------------
  13. using System;
  14. using System.Threading.Tasks;
  15. namespace TouchSocket.Sockets
  16. {
  17. /// <summary>
  18. /// 通过ID发送
  19. /// </summary>
  20. public interface IIDSender
  21. {
  22. /// <summary>
  23. /// 向对应ID的客户端发送
  24. /// </summary>
  25. /// <param name="id">目标ID</param>
  26. /// <param name="buffer">数据</param>
  27. /// <param name="offset">偏移</param>
  28. /// <param name="length">长度</param>
  29. /// <exception cref="NotConnectedException">未连接异常</exception>
  30. /// <exception cref="ClientNotFindException">未找到ID对应的客户端</exception>
  31. /// <exception cref="Exception">其他异常</exception>
  32. void Send(string id, byte[] buffer, int offset, int length);
  33. /// <summary>
  34. /// 向对应ID的客户端发送
  35. /// </summary>
  36. /// <param name="id">目标ID</param>
  37. /// <param name="buffer">数据</param>
  38. /// <param name="offset">偏移</param>
  39. /// <param name="length">长度</param>
  40. /// <exception cref="NotConnectedException">未连接异常</exception>
  41. /// <exception cref="ClientNotFindException">未找到ID对应的客户端</exception>
  42. /// <exception cref="Exception">其他异常</exception>
  43. Task SendAsync(string id, byte[] buffer, int offset, int length);
  44. /// <summary>
  45. /// 向对应ID的客户端发送
  46. /// </summary>
  47. /// <param name="id">目标ID</param>
  48. /// <param name="requestInfo">数据对象</param>
  49. /// <exception cref="NotConnectedException">未连接异常</exception>
  50. /// <exception cref="ClientNotFindException">未找到ID对应的客户端</exception>
  51. /// <exception cref="Exception">其他异常</exception>
  52. void Send(string id, IRequestInfo requestInfo);
  53. /// <summary>
  54. /// 向对应ID的客户端发送
  55. /// </summary>
  56. /// <param name="id">目标ID</param>
  57. /// <param name="requestInfo">数据对象</param>
  58. /// <exception cref="NotConnectedException">未连接异常</exception>
  59. /// <exception cref="ClientNotFindException">未找到ID对应的客户端</exception>
  60. /// <exception cref="Exception">其他异常</exception>
  61. Task SendAsync(string id, IRequestInfo requestInfo);
  62. }
  63. }