{"id":16105818,"url":"https://github.com/devlights/dotnet-tcpclient-keepalive-example","last_synced_at":"2025-04-06T03:13:22.886Z","repository":{"id":175196770,"uuid":"653487798","full_name":"devlights/dotnet-tcpclient-keepalive-example","owner":"devlights","description":"This is a example of exchanging keep-alive probes with TcpClient (SO_KEEPALIVE).","archived":false,"fork":false,"pushed_at":"2023-06-18T16:57:18.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-12T08:58:27.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devlights.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":"2023-06-14T06:43:31.000Z","updated_at":"2023-06-16T17:58:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"37f18543-95ee-4c92-bde5-1b34575aef17","html_url":"https://github.com/devlights/dotnet-tcpclient-keepalive-example","commit_stats":null,"previous_names":["devlights/dotnet-tcpclient-keepalive-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fdotnet-tcpclient-keepalive-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fdotnet-tcpclient-keepalive-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fdotnet-tcpclient-keepalive-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fdotnet-tcpclient-keepalive-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlights","download_url":"https://codeload.github.com/devlights/dotnet-tcpclient-keepalive-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427012,"owners_count":20937214,"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":[],"created_at":"2024-10-09T19:10:42.250Z","updated_at":"2025-04-06T03:13:22.869Z","avatar_url":"https://github.com/devlights.png","language":"C#","readme":"# dotnet-tcpclient-keepalive-example\n\nThis is a example of exchanging keep-alive probes with TcpClient (SO_KEEPALIVE).\n\n## Environments\n\n```sh\n$ lsb_release -a\nNo LSB modules are available.\nDistributor ID: Ubuntu\nDescription:    Ubuntu 22.04.2 LTS\nRelease:        22.04\nCodename:       jammy\n```\n\n```sh\n$ dotnet --version\n7.0.100\n```\n\nThe sample code in this repository runs on both Windows and Linux; to run it on Windows, uncomment and adjust [client/Program.cs](client/Program.cs).\n\n\n## Requirements\n\n### Task (go-task)\n\n```sh\n$ go install github.com/go-task/task/v3/cmd/task@latest\n```\n\n### tcpdump\n\n```sh\n$ sudo apt update\n$ sudo apt install -y tcpdump\n```\n\n## How to Run\n\nOpen three terminals. the first terminal, do the following\n\n```sh\n$ task capture\n```\n\nthe second terminal, do the following\n\n```sh\n$ task server\n```\n\nthe third terminal, do the following\n\n```sh\n$ task client\n```\n\nAfter a while, the first terminal outputs the following results.\n\nThe following is the result of a run on Gitpod.\n\n```sh\n$ task capture\ntask: [capture] sudo tcpdump -i lo 'tcp and port 12345 and tcp[13] \u0026 16 != 0 and tcp[12] \u0026 15 = 0'\ntcpdump: verbose output suppressed, use -v[v]... for full protocol decode\nlistening on lo, link-type EN10MB (Ethernet), snapshot length 262144 bytes\n07:16:46.205364 IP localhost.12345 \u003e localhost.51758: Flags [S.], seq 2513543126, ack 2626466582, win 43690, options [mss 65495,sackOK,TS val 4204759295 ecr 4204759295,nop,wscale 7], length 0\n07:16:46.205387 IP localhost.51758 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204759295 ecr 4204759295], length 0\n07:16:48.210721 IP localhost.51758 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204761300 ecr 4204759295], length 0\n07:16:48.210733 IP localhost.12345 \u003e localhost.51758: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204761300 ecr 4204759295], length 0\n07:16:50.222709 IP localhost.51758 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204763312 ecr 4204761300], length 0\n07:16:50.222716 IP localhost.12345 \u003e localhost.51758: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204763312 ecr 4204759295], length 0\n07:16:52.238732 IP localhost.51758 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204765328 ecr 4204763312], length 0\n07:16:52.238739 IP localhost.12345 \u003e localhost.51758: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204765328 ecr 4204759295], length 0\n07:16:54.254711 IP localhost.51758 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204767344 ecr 4204765328], length 0\n07:16:54.254717 IP localhost.12345 \u003e localhost.51758: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204767344 ecr 4204759295], length 0\n07:16:56.274647 IP localhost.51758 \u003e localhost.12345: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204769364 ecr 4204767344], length 0\n07:16:56.274658 IP localhost.12345 \u003e localhost.51758: Flags [.], ack 1, win 342, options [nop,nop,TS val 4204769364 ecr 4204759295], length 0\n07:16:56.410255 IP localhost.51758 \u003e localhost.12345: Flags [F.], seq 1, ack 1, win 342, options [nop,nop,TS val 4204769500 ecr 4204769364], length 0\n07:16:56.414705 IP localhost.12345 \u003e localhost.51758: Flags [.], ack 2, win 342, options [nop,nop,TS val 4204769504 ecr 4204769500], length 0\n07:16:56.425536 IP localhost.12345 \u003e localhost.51758: Flags [F.], seq 1, ack 2, win 342, options [nop,nop,TS val 4204769515 ecr 4204769500], length 0\n07:16:56.425547 IP localhost.51758 \u003e localhost.12345: Flags [.], ack 2, win 342, options [nop,nop,TS val 4204769515 ecr 4204769515], length 0\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fdotnet-tcpclient-keepalive-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlights%2Fdotnet-tcpclient-keepalive-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fdotnet-tcpclient-keepalive-example/lists"}