{"id":22957851,"url":"https://github.com/taherfattahi/grpcnetframework","last_synced_at":"2025-07-26T03:10:24.496Z","repository":{"id":107209500,"uuid":"320212896","full_name":"taherfattahi/GrpcNetframework","owner":"taherfattahi","description":"Using gRPC Services in .NET Framework","archived":false,"fork":false,"pushed_at":"2025-07-02T10:02:59.000Z","size":2018,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-02T11:22:32.731Z","etag":null,"topics":["grpc","netframework"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taherfattahi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-12-10T08:50:21.000Z","updated_at":"2025-07-02T10:03:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"c66e0290-f557-48dc-a781-ce2568ad36c8","html_url":"https://github.com/taherfattahi/GrpcNetframework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/taherfattahi/GrpcNetframework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taherfattahi%2FGrpcNetframework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taherfattahi%2FGrpcNetframework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taherfattahi%2FGrpcNetframework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taherfattahi%2FGrpcNetframework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taherfattahi","download_url":"https://codeload.github.com/taherfattahi/GrpcNetframework/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taherfattahi%2FGrpcNetframework/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267110027,"owners_count":24037632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc","netframework"],"created_at":"2024-12-14T17:21:18.225Z","updated_at":"2025-07-26T03:10:24.488Z","avatar_url":"https://github.com/taherfattahi.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GrpcNetframework\nUsing \u003ca href=\"https://grpc.io/docs/what-is-grpc/introduction/\"\u003egRPC\u003c/a\u003e Services in .NET Framework\n\u003cbr\u003e\nIn GrpcLibrary, the \u003cb\u003etransfer.cm\u003c/b\u003e file contains the source code generated by the protocol buffer compiler.\n\u003cbr\u003e\n## ChatServiceToServer.proto:\n```html\nsyntax = \"proto3\";\npackage GrpcLibrary;\nservice GrpcLibrary {\n  rpc RequestStringFunction (RequestString) returns (RequestString);\n  rpc SendMessageFunction (SendMessage) returns (SendMessage);\n  rpc RequestByteFunction (RequestByte) returns (RequestByte);\n  rpc SayHello (HelloRequest) returns (HelloReply) {}\n}\n\nmessage Empty {}\n\nmessage HelloRequest {\n  string name = 1;\n}\n  \nmessage HelloReply {\n  string message = 1;\n}\n\nmessage RequestString {\n    string sourceId = 1;\n    repeated string destinationIDs = 2;\n    string rqst = 3;\n    string option = 4;\n}\n\nmessage SendMessage {\n    string sourceID = 1;\n    repeated string destinationIDs = 2;\n    string msg = 3;\n    string option = 4;\n}\n\nmessage RequestByte {\n    string sourceID = 1;\n    repeated string destinationIDs = 2;\n    string msg = 3;\n    bytes rqst = 4;\n    string option = 5;\n}\n```\n## GrpcServer:\n```html\nnamespace GrpcServer\n{\n    class GrpcImpl : GrpcLibrary.GrpcLibrary.GrpcLibraryBase\n    {\n        // SayHello\n        public override Task\u003cHelloReply\u003e SayHello(HelloRequest request, ServerCallContext context)\n        {\n            return Task.FromResult(new HelloReply { Message = \"Hello \" + request.Name });\n        }\n    }\n    class Program\n    {\n        static int[] listofPortNumber = new int[] { 10011, 10012, 10013, 10007 };\n        static void Main(string[] args)\n        {\n            int Port = FreeTcpPort();\n\n            Server server = new Server\n            {\n                Services = { GrpcLibrary.GrpcLibrary.BindService(new GrpcImpl()) },\n                Ports = { new ServerPort(\"localhost\", Port, ServerCredentials.Insecure) }\n            };\n            server.Start();\n\n            Console.WriteLine(\"GrpcService server listening on port \" + Port);\n            Console.ReadKey();\n\n            server.ShutdownAsync().Wait();\n        }\n        public static int FreeTcpPort()\n        {\n            for (int i = 0; i \u003c listofPortNumber.Length; i++)\n            {\n                try\n                {\n                    TcpListener l = new TcpListener(IPAddress.Loopback, listofPortNumber[i]);\n                    l.Start();\n                    int port = ((IPEndPoint)l.LocalEndpoint).Port;\n                    l.Stop();\n                    return port;\n                }\n                catch\n                {\n                    continue;\n                }\n            }\n            return 0;\n        }\n\n    }\n}\n```\n\n## GrpcClient:\n```html\nnamespace GrpcClient\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            int[] listofPortNumber = new int[] { 10011, 10012, 10013, 10007 };\n\n            Channel channel = null;\n            bool isConnected = false;\n            for (int i = 0; i \u003c listofPortNumber.Length; i++)\n            {\n                channel = new Channel(\"127.0.0.1:\" + listofPortNumber[i], ChannelCredentials.Insecure);\n                if (IsReady(channel))\n                {\n                    isConnected = true;\n                    break;\n                }\n            }\n\n            if (channel != null \u0026\u0026 isConnected)\n            {\n                var client = new GrpcLibrary.GrpcLibrary.GrpcLibraryClient(channel);\n                while (true)\n                {\n                    try\n                    {\n                        Console.WriteLine(\"type something:  \");\n                        var input = Console.ReadLine();\n                        var reply = client.SayHello(new HelloRequest { Name = input });\n                        Console.WriteLine(\"reply: \" + reply.Message);\n\n                        //channel.ShutdownAsync().Wait();\n                        //Console.ReadKey();\n                    }\n                    catch (Exception ex)\n                    {\n                    }\n                }\n            }\n        }\n        public static bool IsReady(Channel channel)\n        {\n            channel.ConnectAsync();\n            return channel.State == ChannelState.Ready;\n        }\n\n    }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaherfattahi%2Fgrpcnetframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaherfattahi%2Fgrpcnetframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaherfattahi%2Fgrpcnetframework/lists"}