pingx

pingx is a lightweight Swift library for determining network latency between a client and server using ICMP (Internet Control Message Protocol) packets. It provides a simple and flexible API for sending and managing ping requests to IPv4 addresses.

9
0
Swift

pingx

Version
License
codecov
codebeat badge
Codacy Badge
Platform

Introduction

This ultralight and easy-to-use library is designed to help developers accurately measure and analyze network ping latency in their applications. Whether you’re working on a project that requires real-time communication, online gaming, or network performance monitoring, this library provides a seamless solution to assess and optimize ping times.

Installation

CocoaPods

To integrate pingx into your Xcode project using CocoaPods, add the following line to your Podfile:

pod 'pingx'

Then, run the following command:

$ pod install

Swift Package Manager (SPM)

To integrate pingx into your Xcode project using Swift Package Manager, add the following dependency to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/shineRR/pingx", .upToNextMajor(from: "1.0.0"))
]

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Integration

Import the pingx module into your Swift code and initialize the Pinger instance.

import pingx

let pinger = ContinuousPinger()
pinger.delegate = self

let destination = IPv4Address(address: (8, 8, 8, 8))
let request = Request(destination: destination, demand: .unlimited)

pinger.ping(request: request)

Author

pingx is developed and maintained by shineRR.

License

pingx is available under the MIT license. See the LICENSE file for more info.