GithubHelp home page GithubHelp logo

fredatgithub / xamarin.simpleping Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jamesmontemagno/xamarin.simpleping

0.0 1.0 0.0 314 KB

SimplePing demonstrates ping (ICMP) send and receive.

License: MIT License

C# 52.72% PowerShell 30.57% Shell 16.72%

xamarin.simpleping's Introduction

Xamarin.SimplePing

Build Status

SimplePing demonstrates ping (ICMP) send and receive.

A Xamarin.iOS and Xamarin.Mac binding for the Apple sample: https://developer.apple.com/library/content/samplecode/SimplePing

On most platforms ping requires privileges (it's implemented with a raw IP socket). Apple platforms include a special facility that allows you to ping without privileges. Specifically, you can open a special, non-privileged ICMP socket that allows you to send and receive pings.

To use the SimplePing class:

  1. create an instance of the SimplePing class and keep a reference to that instance
  2. set the Delegate property or the Started event.
  3. call Start().
  4. if things go well, your delegate's DidStartWithAddress() method, or the Started event, will be called; to send a ping, call SendPing()
  5. when SimplePing receives an ICMP packet, it will call the DidReceivePingResponsePacket() method, or the ResponseRecieved event

SimplePing can be used from any thread but the use of any single instance must be confined to a specific thread. Moreover, that thread must run its run loop. In most cases it's best to use SimplePing from the main thread.

var pinger = new SimplePing("www.apple.com");

pinger.Started += (sender, e) => {
    var endpoint = e.EndPoint;
    pinger.SendPing(null);
};

pinger.ResponseRecieved += (sender, e) => {
    var seq = e.SequenceNumber;
    var packet = e.Packet;
};

pinger.Start();

xamarin.simpleping's People

Contributors

mattleibow avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.