IOutputChannelProxy.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Threading.Tasks;
  3. using Vinno.IUS.Common.IO;
  4. namespace Vinno.IUS.Common.Network.Channels
  5. {
  6. internal interface IOutputChannelProxy : IChannelProxy
  7. {
  8. /// <summary>
  9. /// Send buffer to remote.
  10. /// </summary>
  11. /// <param name="buffer">The buffer to send</param>
  12. /// <param name="timeout">Wait forever if the value is 0</param>
  13. /// <returns>The return buffer from remote.</returns>
  14. IBuffer Send(IBuffer buffer, int timeout = 0);
  15. /// <summary>
  16. /// Send buffer to remote.
  17. /// </summary>
  18. /// <param name="buffer">The buffer to send</param>
  19. /// <param name="resultCallback">When receive a part of buffers, the callback will be called.</param>
  20. /// <param name="timeout">Wait forever if the value is 0</param>
  21. void Send(IBuffer buffer, Func<IBuffer, bool> resultCallback, int timeout = 0);
  22. /// <summary>
  23. /// Send buffer to remote by async way.
  24. /// </summary>
  25. /// <param name="buffer">The buffer to send</param>
  26. /// <param name="timeout">Wait forever if the value is 0</param>
  27. /// <returns>The return buffer from remote.</returns>
  28. Task<IBuffer> SendAsync(IBuffer buffer, int timeout = 0);
  29. /// <summary>
  30. /// Send buffer to remote by asnyc way.
  31. /// </summary>
  32. /// <param name="buffer">The buffer to send</param>
  33. /// <param name="resultCallback">When receive a part of buffers, the callback will be called.</param>
  34. /// <param name="timeout">Wait forever if the value is 0</param>
  35. Task SendAsync(IBuffer buffer, Func<IBuffer, bool> resultCallback, int timeout = 0);
  36. /// <summary>
  37. /// Indicate the channel was timeout
  38. /// </summary>
  39. /// <param name="channelId">The channelId</param>
  40. void SetTimeoutExceptionFlag(out int channelId);
  41. }
  42. }