sanetworktester

The Sanetworktester framework is a powerful tool for network testing and debugging in iOS applications. It provides a simple and intuitive way to perform various network operations, including checking network availability, measuring network speed, and diagnosing network issues. With Sanetworktester, developers can easily enhance the networking functionalities of their apps and ensure a seamless user experience.

Features

  • Check network availability: Sanetworktester allows you to quickly check if the device is connected to the internet or not, enabling you to handle different network states appropriately in your app.
  • Measure network speed: With Sanetworktester, you can measure the upload and download speed of the current network connection. This information can be useful for optimizing data transfer and providing users with accurate status updates.
  • Diagnose network issues: The framework provides functionalities to diagnose network issues by performing DNS lookups, pinging remote hosts, and tracing network routes. This helps in identifying and resolving potential network problems.
  • Retrieve network information: Sanetworktester allows you to fetch information about the current network connection, such as IP address, subnet mask, gateway, and more. This information can be used for various purposes, such as displaying network details to the user or performing advanced network operations.
  • Customizable and easy to integrate: The framework is highly customizable and can be easily integrated into your existing iOS projects. It provides a flexible set of options to configure network testing parameters according to your specific requirements.

Installation

To install Sanetworktester in your iOS project, follow these steps:

  1. Open your project in Xcode.
  2. Navigate to the project directory and create a new folder named “Frameworks”.
  3. Download the latest version of Sanetworktester from the official GitHub repository: https://github.com/sanetworktester/sanetworktester.
  4. Extract the downloaded package.
  5. Drag and drop the Sanetworktester.framework folder into the “Frameworks” folder in your project.
  6. In Xcode, select your project target, go to the “General” tab, and scroll down to the “Frameworks, Libraries, and Embedded Content” section.
  7. Add Sanetworktester.framework from the “Frameworks” folder to the list of embedded frameworks.
  8. Build and run your project to make sure Sanetworktester is successfully integrated.

Usage

Using Sanetworktester is straightforward. Simply follow the steps below:

  1. Import Sanetworktester in the files where you want to use its functionalities:
import Sanetworktester
  1. Check network availability:
// Check if the device is connected to the internet
if Sanetworktester.isInternetAvailable() {
    // Internet is available
} else {
    // No internet connection
}
  1. Measure network speed:
// Measure network speed
Sanetworktester.measureSpeed { (speed) in
    // Speed measurement complete
    print("Download speed: \\(speed.downloadSpeed) Mbps")
    print("Upload speed: \\(speed.uploadSpeed) Mbps")
}
  1. Diagnose network issues:
// Perform a DNS lookup
Sanetworktester.performDNSLookup(host: "example.com") { (result) in
    if let ip = result.ipAddress {
        // DNS lookup successful
        print("IP address: \\(ip)")
    } else {
        // DNS lookup failed
        print("DNS lookup failed")
    }
}

// Ping a remote host
Sanetworktester.ping(host: "example.com") { (result) in
    if result.isSuccessful {
        // Ping successful
        print("Ping successful")
        print("Round-trip time: \\(result.roundTripTime) ms")
    } else {
        // Ping failed
        print("Ping failed")
    }
}
  1. Retrieve network information:
// Get network information
let networkInfo = Sanetworktester.networkInformation()
print("IP address: \\(networkInfo.ipAddress)")
print("Subnet mask: \\(networkInfo.subnetMask)")
print("Gateway: \\(networkInfo.gateway)")

// Additional network details
print("SSID: \\(networkInfo.ssid ?? "Not available")")
print("BSSID: \\(networkInfo.bssid ?? "Not available")")
  1. Customize network testing parameters:
// Customize Sanetworktester settings
Sanetworktester.setNetworkTestConfiguration { (configuration) in
    configuration.timeoutInterval = 10
    configuration.maximumConcurrentTests = 5
    configuration.packetSize = 1024
    // Configure other parameters as per your requirements
}

These are just a few examples of the features and usage of Sanetworktester. For more detailed information, refer to the official documentation and sample projects available on the GitHub repository.