{"id":23875283,"url":"https://github.com/whiteccinn/named-pipe-ipc","last_synced_at":"2025-08-16T19:05:09.155Z","repository":{"id":109499673,"uuid":"369056792","full_name":"whiteCcinn/named-pipe-ipc","owner":"whiteCcinn","description":"🚀 With the aid of a go named pipe to achieve fast communication with the process(Full Duplex)","archived":false,"fork":false,"pushed_at":"2021-07-12T03:01:53.000Z","size":50,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-29T09:04:57.656Z","etag":null,"topics":["full-duplex","named","noblock","pipe","two-way-communication"],"latest_commit_sha":null,"homepage":"","language":"Go","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/whiteCcinn.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}},"created_at":"2021-05-20T02:29:30.000Z","updated_at":"2024-04-01T02:09:26.000Z","dependencies_parsed_at":"2023-08-17T23:16:54.211Z","dependency_job_id":null,"html_url":"https://github.com/whiteCcinn/named-pipe-ipc","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/whiteCcinn/named-pipe-ipc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteCcinn%2Fnamed-pipe-ipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteCcinn%2Fnamed-pipe-ipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteCcinn%2Fnamed-pipe-ipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteCcinn%2Fnamed-pipe-ipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whiteCcinn","download_url":"https://codeload.github.com/whiteCcinn/named-pipe-ipc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteCcinn%2Fnamed-pipe-ipc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270756872,"owners_count":24639954,"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-08-16T02:00:11.002Z","response_time":91,"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":["full-duplex","named","noblock","pipe","two-way-communication"],"created_at":"2025-01-03T18:19:38.464Z","updated_at":"2025-08-16T19:05:09.126Z","avatar_url":"https://github.com/whiteCcinn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# named_pipe_ipc\n🚀 With the aid of a named pipe to achieve fast communication with the process\n\n## Features\n\n- named-pipe-ipc(Not limited to parent-child processes)\n- full-duplex communication\n\n## Installation\n\n```shell\ngo get github.com/whiteCcinn/named-pipe-ipc\n```\n\n## Usage\n\n### server\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\tnamed_pipe_ipc \"github.com/whiteCcinn/named-pipe-ipc\"\n\t\"log\"\n\t\"time\"\n)\n\nfunc main() {\n\tctx, _ := context.WithTimeout(context.Background(), 3*time.Second)\n\t// use pipe-IPC\n\tnctx, err := named_pipe_ipc.NewContext(ctx, \"./\", named_pipe_ipc.S)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tgo func() {\n\t\tgo func() {\n\t\t\tfor {\n\t\t\t\tdsm, err := nctx.Recv(true)\n\t\t\t\tif err != nil \u0026\u0026 err.Error() != named_pipe_ipc.PipeClosedMessage {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\tlog.Println(\"from clint\", dsm.Payload())\n\n\t\t\t\t_, err = nctx.Send(dsm.ResponsePayload(named_pipe_ipc.Message(\"send to client\")))\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\terr = nctx.Listen()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}()\n\n\tfor {\n\t\tlog.Println(\"I am server\")\n\t\ttime.Sleep(5 * time.Second)\n\t\tif err := nctx.Close(); err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tbreak\n\t}\n}\n\n\n```\n\n### client\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\tnamed_pipe_ipc \"github.com/whiteCcinn/named-pipe-ipc\"\n\t\"log\"\n)\n\nfunc main() {\n\tnctx, err := named_pipe_ipc.NewContext(context.Background(), \"./\", named_pipe_ipc.C)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = nctx.Send(named_pipe_ipc.Message(\"nihao\"))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tmsg, err := nctx.Recv(true)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Println(\"from server\", msg)\n}\n}\n```\n\n## More Example\n- [example](https://github.com/whiteCcinn/named-pipe-ipc/tree/main/example)\n\n## Example Log\n\n```go\nroot@0140ee5d78cf:/www/example# go run server.go\n2021/05/20 07:47:05 I am server\n2021/05/20 07:47:10 I am server\n2021/05/20 07:47:12 from clint nihao\n\n2021/05/20 07:47:12 pass\n2021/05/20 07:47:15 I am server\n\n# other tty\nroot@0140ee5d78cf:/www/example# go run client.go\n2021/05/20 07:47:12 from server send to client\n```\n\n## Stress Test\n\n```\n## server\ngo run example/noblock_server.go\n\n# other window\ni=\"0\";while [ $i -lt 10 ]; do nohup go run example/noblock_client.go \u003e output.$i 2\u003e\u00261 \u0026;i=$[$i+1];done\n\n# see the out.* content\n```\n\n## Projects using\n\n- [whiteCcinn/daemon: Go supervisor daemon module, similar to the Erlang | python's supervisor, assist you in better monitor your business processes 🚀](https://github.com/whiteCcinn/daemon)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhiteccinn%2Fnamed-pipe-ipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhiteccinn%2Fnamed-pipe-ipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhiteccinn%2Fnamed-pipe-ipc/lists"}