{"id":19303020,"url":"https://github.com/antosmichael07/go-tcp-connection","last_synced_at":"2025-07-21T07:03:54.867Z","repository":{"id":242750710,"uuid":"810441064","full_name":"antosmichael07/Go-TCP-Connection","owner":"antosmichael07","description":"A library meant to simplify the process of making TCP request and responses.","archived":false,"fork":false,"pushed_at":"2024-12-22T08:36:30.000Z","size":74,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T01:51:28.508Z","etag":null,"topics":["client","connection","go","golang","server","tcp","tcp-client","tcp-server","tcp-socket"],"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/antosmichael07.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":"2024-06-04T17:48:25.000Z","updated_at":"2024-12-22T08:36:33.000Z","dependencies_parsed_at":"2024-06-04T20:47:52.677Z","dependency_job_id":"1661509b-a97d-45f8-9bb6-783fa1e7128d","html_url":"https://github.com/antosmichael07/Go-TCP-Connection","commit_stats":null,"previous_names":["antosmichael07/go-tcp-connection"],"tags_count":119,"template":false,"template_full_name":null,"purl":"pkg:github/antosmichael07/Go-TCP-Connection","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antosmichael07%2FGo-TCP-Connection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antosmichael07%2FGo-TCP-Connection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antosmichael07%2FGo-TCP-Connection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antosmichael07%2FGo-TCP-Connection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antosmichael07","download_url":"https://codeload.github.com/antosmichael07/Go-TCP-Connection/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antosmichael07%2FGo-TCP-Connection/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266255244,"owners_count":23900098,"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","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":["client","connection","go","golang","server","tcp","tcp-client","tcp-server","tcp-socket"],"created_at":"2024-11-09T23:24:39.860Z","updated_at":"2025-07-21T07:03:54.838Z","avatar_url":"https://github.com/antosmichael07.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go-TCP-Connection\n\n- A library meant to simplify the process of making TCP/UDP request and responses\n- Install with `go get github.com/antosmichael07/Go-TCP-Connection`\n\n## Rules\n\n- Your events need to start from 4, events from 0 to 3 are reserved for client to server communication\n\n## Example\n\n### Server\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\tlgr \"github.com/antosmichael07/Go-Logger\"\n\ttcp \"github.com/antosmichael07/Go-TCP-Connection\"\n)\n\nconst (\n\tevent_test uint16 = iota + 4\n)\n\nfunc main() {\n\tserver := tcp.NewServer(\"localhost:8080\", \"tcp\")\n\tserver.Logger.Level = lgr.Warning\n\n\tserver.OnConnect(func(conn *tcp.Connection) {\n\t\tmsg := []byte(\"Hello from the server\")\n\t\tserver.SendData(conn, event_test, \u0026msg)\n\t})\n\n\tserver.On(event_test, func(data *[]byte, conn *tcp.Connection) {\n\t\tfmt.Println(\"Received data from client:\", string(*data))\n\t})\n\n\tserver.Start()\n}\n```\n\n### Client\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\tlgr \"github.com/antosmichael07/Go-Logger\"\n\ttcp \"github.com/antosmichael07/Go-TCP-Connection\"\n)\n\nconst (\n\tevent_test uint16 = iota + 4\n)\n\nfunc main() {\n\tclient := tcp.NewClient(\"localhost:8080\", \"tcp\")\n\tclient.Logger.Level = lgr.Warning\n\tclient.Connect()\n\n\tclient.On(event_test, func(data *[]byte) {\n\t\tfmt.Println(\"Received data from the server: \", string(*data))\n\n\t\tmsg := []byte(\"Hello from the client\")\n\t\tclient.SendData(event_test, \u0026msg)\n\t})\n\n\tclient.Listen()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantosmichael07%2Fgo-tcp-connection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantosmichael07%2Fgo-tcp-connection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantosmichael07%2Fgo-tcp-connection/lists"}