{"id":17247065,"url":"https://github.com/lmirosevic/gbping","last_synced_at":"2025-04-06T03:09:43.986Z","repository":{"id":6669376,"uuid":"7914163","full_name":"lmirosevic/GBPing","owner":"lmirosevic","description":"Highly accurate ICMP Ping controller for iOS","archived":false,"fork":false,"pushed_at":"2019-03-20T07:56:52.000Z","size":204,"stargazers_count":279,"open_issues_count":17,"forks_count":87,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-30T02:06:49.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lmirosevic.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}},"created_at":"2013-01-30T12:28:05.000Z","updated_at":"2024-11-06T09:44:39.000Z","dependencies_parsed_at":"2022-08-28T03:51:09.443Z","dependency_job_id":null,"html_url":"https://github.com/lmirosevic/GBPing","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmirosevic%2FGBPing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmirosevic%2FGBPing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmirosevic%2FGBPing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lmirosevic%2FGBPing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lmirosevic","download_url":"https://codeload.github.com/lmirosevic/GBPing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"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-15T06:35:55.930Z","updated_at":"2025-04-06T03:09:43.969Z","avatar_url":"https://github.com/lmirosevic.png","language":"Objective-C","funding_links":[],"categories":["\u003ca id=\"58cd9084afafd3cd293564c1d615dd7f\"\u003e\u003c/a\u003e工具"],"sub_categories":["\u003ca id=\"d0108e91e6863289f89084ff09df39d0\"\u003e\u003c/a\u003e新添加的"],"readme":"# GBPing ![Version](https://img.shields.io/cocoapods/v/GBPing.svg?style=flat)\u0026nbsp;![License](https://img.shields.io/badge/license-Apache_2-green.svg?style=flat)\n\nHighly accurate ICMP Ping controller for iOS (not based on Apple Sample Code, see \"Details\" section)\n\nDetails\n------------\n\nThis code is a low level ping library that gives extremely accurate round-trip timing results without being impacted by UI and other processing on the main thread. This is not the case with most other ping libraries such as the typical Apple SimplePing which are built as a single threaded class interleaved within the main thread of execution, causing them to suffer from all kinds of indeterministic errors. This library is a multi-threaded class built on top of BSD sockets and GCD, delivering the best possible timing accuracy regardless of system resource state or device performance.\n\nUsage\n------------\n\nFirst import header\n\n```objective-c\n#import \u003cGBPing/GBPing.h\u003e\n```\n\nBasic usage:\n\n```objective-c\nself.ping = [[GBPing alloc] init];\nself.ping.host = @\"google.com\";\nself.ping.delegate = self;\nself.ping.timeout = 1.0;\nself.ping.pingPeriod = 0.9;\n\n[self.ping setupWithBlock:^(BOOL success, NSError *error) { //necessary to resolve hostname\n    if (success) {\n        //start pinging\n        [self.ping startPinging];\n        \n        //stop it after 5 seconds\n        [NSTimer scheduledTimerWithTimeInterval:5 repeats:NO withBlock:^{\n            NSLog(@\"stop it\");\n            [self.ping stop];\n            self.ping = nil;\n        }];\n    }\n    else {\n        NSLog(@\"failed to start\");\n    }\n}];\n```\n\nImplement optional delegate methods:\n\n```objective-c\n-(void)ping:(GBPing *)pinger didReceiveReplyWithSummary:(GBPingSummary *)summary {\n    NSLog(@\"REPLY\u003e  %@\", summary);\n}\n\n-(void)ping:(GBPing *)pinger didReceiveUnexpectedReplyWithSummary:(GBPingSummary *)summary {\n    NSLog(@\"BREPLY\u003e %@\", summary);\n}\n\n-(void)ping:(GBPing *)pinger didSendPingWithSummary:(GBPingSummary *)summary {\n    NSLog(@\"SENT\u003e   %@\", summary);\n}\n\n-(void)ping:(GBPing *)pinger didTimeoutWithSummary:(GBPingSummary *)summary {\n    NSLog(@\"TIMOUT\u003e %@\", summary);\n}\n\n-(void)ping:(GBPing *)pinger didFailWithError:(NSError *)error {\n    NSLog(@\"FAIL\u003e   %@\", error);\n}\n\n-(void)ping:(GBPing *)pinger didFailToSendPingWithSummary:(GBPingSummary *)summary error:(NSError *)error {\n    NSLog(@\"FSENT\u003e  %@, %@\", summary, error);\n}\n```\n\nDemo project\n------------\n\nSee: [github.com/lmirosevic/GBPingDemo](https://github.com/lmirosevic/GBPingDemo)\n\nFeatures\n------------\n\nGBPing provides the following info (inside a GBPingSummaryObject exposed as properties):\n\n* NSUInteger        sequenceNumber;\n* NSUInteger        payloadSize;\n* NSUInteger        ttl;\n* NSString          *host;\n* NSDate            *sendDate;\n* NSDate            *receiveDate;\n* NSTimeInterval    rtt;\n* GBPingStatus      status;\n\nDependencies\n------------\n\nNone\n\nCopyright \u0026 License\n------------\n\nCopyright 2015 Luka Mirosevic\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmirosevic%2Fgbping","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flmirosevic%2Fgbping","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flmirosevic%2Fgbping/lists"}