Coder Social home page Coder Social logo

lanscanner's Introduction

THIS REPOSITORY IS NO LONGER MAINTAINED

LANScanner

Version License Platform

Easily scan a Wi-Fi network for devices

Installation

CocoaPods

LANScanner is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LANScanner"

Usage

Start a scan

let scanner = LANScanner(delegate: self, continuous: false)
scanner?.startScan()

Be sure to implement the delegate LANScannerDelegate

Get IP address of local device

var netInfo = LANScanner.getLocalAddress()
print(netInfo.ip)
print(netInfo.netmask)

Interface

/// Public
var delegate:LANScannerDelegate // Delegate for discovery callbacks
var continuous:Bool // When set this will restart the scan when completed

func startScan() // Begin a scan
func stopScan() // End a scan

static func getHostName(ipaddress: String) -> String? // Get the hostname from an IP address
static func getLocalAddress() -> NetInfo? // Get the local devices IP address and 

/// Delegate
func LANScannerDiscovery(device: LANDevice)
func LANScannerFinished()    
func LANScannerRestarted()
func LANScannerFailed(error: NSError)  

Author

Chris Anderson:

License

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

lanscanner's People

Contributors

nsurlsession0 avatar pushchris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lanscanner's Issues

No such module 'ifaddrsiOS'

I just installed the pod, and from my workspace tried to run my app on an iPad Mini, and getting the compile error:

No such module 'ifaddrsiOS'

I also just tried an iPad Pro Sim, and getting

No such module 'ifaddrsiOSSim'

Screenshot:

screen shot 2016-10-23 at 7 50 35 pm

I'm running Xcode Version 8.0 (8A218a), targeting iOS 9.3

Hostname not returned (iOS 10.2)

Hi,

I just installed for the first time using CocoaPods and noticed that when calling device.hostName the devices IP address is being returned. I'm guessing a change has been introduced and it is not longer parsing the hostname correctly?

I have included a screenshot from the demo app that demonstrates the issue.

Tom

screen shot 2017-01-05 at 22 55 47

Method LANScanner.startScan() gets error 101 due of different network environment

When trying to integrate the LanScanner pod on a iPad Air 2 simulator I get the error code 101.
Trying to debug the problem I found that the method getLocalAddress() returns nil. Taking a look in the code it seems that the while loop that is looking for the "en0" string on the interface name are not matched. That error was triggered because I might be using an external network card.

What if it could be changed to the following:

  let name = String(cString:interface.ifa_name)
  if name..range(of:"en") != nil {
     //...
}

Would be glad if you allow me to do a pull request.

Regards,

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.