EzHttp框架提供的内置接口,用于文件流等传输
流传输调用代码示例
内置接口:
public interface IEzStreamHandler { Task<byte[]> GetData(string id); }
服务端:
EzDefaultStreamHandler.MapFile("thefilekeyabcdefg", "input.txt"); EzHttp.EzServer server = new EzHttp.EzServer(); server.Start($"http://127.0.0.1:8000/");
客户端:
EzClient.Initialize("http://127.0.0.1:8000/"); var streamApi = EzClient.ProxyFactory.GetProxy<IEzStreamHandler>(); var bytes = streamApi.GetData("thefilekeyabcdefg").Result; var output1 = Encoding.UTF8.GetString(bytes);
时间: 2024-10-14 21:59:09