• 大小: 0.36M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: demo  RPC  框架  C#  

资源简介


资源截图

代码片段和文件信息

using Hprose.RPC;
using Hprose.RPC.Plugins.Limiter;
using System;
using System.Net;
using System.Threading.Tasks;

class MyService {
    public int Sum(int x int y) {
        return x + y;
    }
}

public interface IMyService {
    Task Sum(int x int y);
}

class Program {
    static async Task RunClient() {
        var client = new Client(“http://127.0.0.1:8080/“);
        client.Use(new ConcurrentLimiter(64).Handler).Use(new RateLimiter(2000).InvokeHandler);
        var begin = DateTime.Now;
        var proxy = client.UseService();
        var n = 5000;
        var tasks = new Task[n];
        for (int i = 0; i < n; ++i) {
            tasks[i] = proxy.Sum(i i);
        }
        await Task.WhenAll(tasks);
        var end = DateTime.Now;
        Console.WriteLine(

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-05 05:36  hprose-dotnet-master\
     文件        2518  2019-04-05 05:36  hprose-dotnet-master\.gitattributes
     文件        1615  2019-04-05 05:36  hprose-dotnet-master\.gitignore
     文件         133  2019-04-05 05:36  hprose-dotnet-master\.travis.yml
     目录           0  2019-04-05 05:36  hprose-dotnet-master\.vscode\
     文件        1272  2019-04-05 05:36  hprose-dotnet-master\.vscode\launch.json
     文件         361  2019-04-05 05:36  hprose-dotnet-master\.vscode\tasks.json
     文件       18648  2019-04-05 05:36  hprose-dotnet-master\Hprose.sln
     文件         596  2019-04-05 05:36  hprose-dotnet-master\HproseKeys.snk
     文件        1089  2019-04-05 05:36  hprose-dotnet-master\LICENSE
     文件        6282  2019-04-05 05:36  hprose-dotnet-master\README.md
     目录           0  2019-04-05 05:36  hprose-dotnet-master\examples\
     文件        2017  2019-04-05 05:36  hprose-dotnet-master\examples\Example.sln
     目录           0  2019-04-05 05:36  hprose-dotnet-master\examples\Limiter\
     文件         399  2019-04-05 05:36  hprose-dotnet-master\examples\Limiter\Limiter.csproj
     文件        1151  2019-04-05 05:36  hprose-dotnet-master\examples\Limiter\Program.cs
     目录           0  2019-04-05 05:36  hprose-dotnet-master\examples\Log\
     文件         399  2019-04-05 05:36  hprose-dotnet-master\examples\Log\Log.csproj
     文件        1316  2019-04-05 05:36  hprose-dotnet-master\examples\Log\Program.cs
     目录           0  2019-04-05 05:36  hprose-dotnet-master\examples\Oneway\
     文件         399  2019-04-05 05:36  hprose-dotnet-master\examples\Oneway\Oneway.csproj
     文件         706  2019-04-05 05:36  hprose-dotnet-master\examples\Oneway\Program.cs
     目录           0  2019-04-05 05:36  hprose-dotnet-master\proj\
     目录           0  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.IO\
     文件       19524  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.IO\GlobalSuppressions.cs
     文件        4943  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.IO\Hprose.IO.csproj
     文件         596  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.IO\HproseKeys.snk
     目录           0  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.RPC.AspNet\
     文件        1213  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.RPC.AspNet\GlobalSuppressions.cs
     文件        2758  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.RPC.AspNet\Hprose.RPC.AspNet.csproj
     文件         596  2019-04-05 05:36  hprose-dotnet-master\proj\Hprose.RPC.AspNet\HproseKeys.snk
............此处省略347个文件信息

评论

共有 条评论