{"id":21429981,"url":"https://github.com/mblumtritt/tcp-client","last_synced_at":"2025-07-14T11:31:02.236Z","repository":{"id":39543451,"uuid":"121896170","full_name":"mblumtritt/tcp-client","owner":"mblumtritt","description":"Use your TCP connections with working timeout.","archived":false,"fork":false,"pushed_at":"2025-03-20T08:34:20.000Z","size":210,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T09:06:21.201Z","etag":null,"topics":["ruby","ruby-gem","socket","tcp","tcp-client","tcp-socket","timeout"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mblumtritt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-02-17T22:00:20.000Z","updated_at":"2025-03-20T08:33:39.000Z","dependencies_parsed_at":"2023-11-27T10:39:59.110Z","dependency_job_id":"1ba3dedf-2787-436e-a52b-91bb184a8ccb","html_url":"https://github.com/mblumtritt/tcp-client","commit_stats":{"total_commits":134,"total_committers":2,"mean_commits":67.0,"dds":0.08955223880597019,"last_synced_commit":"c8abd6e0a10d9b833af1b5a4285a4d10c23cf1ea"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"purl":"pkg:github/mblumtritt/tcp-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Ftcp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Ftcp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Ftcp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Ftcp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mblumtritt","download_url":"https://codeload.github.com/mblumtritt/tcp-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mblumtritt%2Ftcp-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265285206,"owners_count":23740483,"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":["ruby","ruby-gem","socket","tcp","tcp-client","tcp-socket","timeout"],"created_at":"2024-11-22T22:19:59.117Z","updated_at":"2025-07-14T11:31:01.912Z","avatar_url":"https://github.com/mblumtritt.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TCPClient ![version](https://img.shields.io/gem/v/tcp-client?label=)\n\nUse your TCP connections with working timeout.\n\n- Gem: [rubygems.org](https://rubygems.org/gems/tcp-client)\n- Source: [github.com](https://github.com/mblumtritt/tcp-client)\n- Help: [rubydoc.info](https://rubydoc.info/gems/tcp-client/TCPClient)\n\n## Description\n\nThis gem implements a customizable TCP client class that gives you control over time limits. You can set time limits for individual read or write calls or set a deadline for entire call sequences.\nIt has a very small footprint, no dependencies and is easily useable.\n\n## Sample\n\n```ruby\nrequire 'tcp-client'\n\n# create a configuration:\n# - don't use internal buffering\n# - use at least TLS 1.2\ncfg =\n  TCPClient::Configuration.create(\n    buffered: false,\n    ssl_params: {\n      min_version: :TLS1_2\n    }\n  )\n\n# request to Google.com:\n# - limit all network interactions to 1.5 seconds\n# - use the Configuration cfg\n# - send a simple HTTP get request\n# - read the returned message and headers\nresponse =\n  TCPClient.with_deadline(1.5, 'www.google.com:443', cfg) do |client|\n    client.write(\"GET / HTTP/1.1\\r\\nHost: www.google.com\\r\\n\\r\\n\") #=\u003e 40\n    client.readline(\"\\r\\n\\r\\n\") #=\u003e see response\n  end\n\nputs(response)\n```\n\nFor more samples see [the examples dir](./examples)\n\n## Installation\n\nYou can install the gem in your system with\n\n```shell\ngem install tcp-client\n```\n\nYou can use [Bundler](http://gembundler.com/) to add TCPClient to your own project:\n\n```shell\nbundle add tcp-client\n```\n\nAfter that you only need one line of code to have everything together\n\n```ruby\nrequire 'tcp-client'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Ftcp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmblumtritt%2Ftcp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmblumtritt%2Ftcp-client/lists"}