{"id":20199526,"url":"https://github.com/screw-coding/screw-tiny-tcp-server","last_synced_at":"2026-05-30T20:31:26.961Z","repository":{"id":127729647,"uuid":"507856161","full_name":"screw-coding/screw-tiny-tcp-server","owner":"screw-coding","description":"go tcp server with custom packet","archived":false,"fork":false,"pushed_at":"2022-06-27T10:06:02.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-03T08:45:00.472Z","etag":null,"topics":["go","packet","tcp","tcp-client","tcp-server"],"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/screw-coding.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":"2022-06-27T10:05:42.000Z","updated_at":"2022-06-27T10:09:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4e9f4cd-a876-4d7f-b6d3-9c8a4e77312f","html_url":"https://github.com/screw-coding/screw-tiny-tcp-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/screw-coding/screw-tiny-tcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screw-coding%2Fscrew-tiny-tcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screw-coding%2Fscrew-tiny-tcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screw-coding%2Fscrew-tiny-tcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screw-coding%2Fscrew-tiny-tcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/screw-coding","download_url":"https://codeload.github.com/screw-coding/screw-tiny-tcp-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/screw-coding%2Fscrew-tiny-tcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33709269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-30T02:00:06.278Z","response_time":92,"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":["go","packet","tcp","tcp-client","tcp-server"],"created_at":"2024-11-14T04:37:59.742Z","updated_at":"2026-05-30T20:31:26.948Z","avatar_url":"https://github.com/screw-coding.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# screw-tiny-tcp-server\n\ngo实现最简单的tcp客户端和服务端,实现带自定义包结构的tcp客户读和服务端\n\n## 目录结构\n\n```\n├── go.mod\n├── pack_client_server\n│ ├── pack_client.go 带构建包和解析包的客户端\n│ ├── pack_server.go 带构建包和解析包的服务端\n│ └── protocol.go\n├── README.md\n└── toy_client_server\n  ├── toy_client.go 最简单的TCP客户端\n  └── toy_server.go 最简单的TCP服务端\n```\n\n## 说明\n\n因为TCP是流式传输,可能出现客户端发送的内容,分成多段流到达服务端,如果服务端总是认为每次都是客户端一次发送的完整的内容,就会出现内容不完整的问题,因此需要在服务端处理检测内容是否完整的问题\n也就是面试中常出现的:*TCP\"粘包\"问题如何处理?*\n\n我个人看法是TCP协议不存在\"粘包\"问题,应用层才有\"粘包\"问题,不过这本来就是要开发者自己处理的\n\ntoy_client.go运行后,在toy_server.go上可以看到,不一定是一个一个收的,日志里会显示不定长的消息在一起\n\n而在pack_server中,每次都是一个完整的信息\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrew-coding%2Fscrew-tiny-tcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscrew-coding%2Fscrew-tiny-tcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscrew-coding%2Fscrew-tiny-tcp-server/lists"}