{"id":15768034,"url":"https://github.com/thk2b/ping","last_synced_at":"2025-10-04T20:05:24.138Z","repository":{"id":138601048,"uuid":"187761564","full_name":"thk2b/ping","owner":"thk2b","description":"An implementation of the ping command","archived":false,"fork":false,"pushed_at":"2019-05-24T21:52:27.000Z","size":463,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-10-11T14:01:20.524Z","etag":null,"topics":["c","icmp","ip","ping"],"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/thk2b.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":"2019-05-21T04:28:47.000Z","updated_at":"2019-05-24T21:52:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"775e05c6-6cad-46aa-b81a-a1b2b7470a78","html_url":"https://github.com/thk2b/ping","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fping","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fping/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fping/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fping/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thk2b","download_url":"https://codeload.github.com/thk2b/ping/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246458009,"owners_count":20780678,"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":["c","icmp","ip","ping"],"created_at":"2024-10-04T14:00:26.265Z","updated_at":"2025-10-04T20:05:18.836Z","avatar_url":"https://github.com/thk2b.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ping\nA minimal implementation of the ping command\n\n## Quick start\n```sh\n\nmake\n\n./ping google.com\n64 bytes from sfo07s16-in-f78.1e100.net (216.58.195.78): icmp_seq=1 ttl=61 time=4.859 ms\n64 bytes from sfo07s16-in-f78.1e100.net (216.58.195.78): icmp_seq=2 ttl=61 time=4.991 ms\n64 bytes from sfo07s16-in-f78.1e100.net (216.58.195.78): icmp_seq=3 ttl=61 time=4.875 ms\n64 bytes from sfo07s16-in-f78.1e100.net (216.58.195.78): icmp_seq=4 ttl=61 time=4.843 ms\n^C\n--- google.com ping statistics ---\n4 packets transmitted, 4 packets received, 0.0% packet loss\nrtt min/avg/max/mdev = 4.843/4.892/4.991/??? ms\n```\n\nYou must be root to run the command. A dockerfile is provided to run inside a Debian VM:\n\n```sh\ndocker-machine create --driver virtualbox ping\ndocker-machine start ping\neval $(docker-machine env ping)\ndocker build -t local/ping .\ndocker run -itv `pwd`:/ping local/ping\nmake\n```\n\n## Usage\n\n`usage: ./ping host`\n\n## Implementation\n\nThis program uses a raw ICMP socket to sent an ICMP ECHO request to the destination with the sending time as a payload.\nIt then waits for the matching ICMP response and calculates the time difference.\nThe process is repeated untill a SIGINT signal is captured and the program exits after displaying statistics.\n\n## Internals\n\nThe core of the project is layered into 3 modules with clear and minimally-overlapping roles. More specific information can be found in the header files.\n\n### icmp_socket\n\nResponsible for initializing the socket, and sending/receiving data.\nDoesn't care what is being sent or recieved.\n\n### echo\n\nManages the ICMP ECHO packet and filtering of incoming packets.\nDoesn't care how the request is sent or received nor what happens to the payload.\n\n### ping\n\nManages the main loop, request/response lifecyle, statistics and user interface.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthk2b%2Fping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthk2b%2Fping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthk2b%2Fping/lists"}