
- APP LANSCAN ANDROID
- APP LANSCAN FREE
If a host replies to an ICMP ECHO request, the method starts sending UDP packets to the hosts on the min_port-max_port port range. Keep in mind that the hosts are on the local network so this shouldn't take more than 10 ms. The icmp_timeout (optional) parameter default : 50 specifies how much time in milliseconds each ICMP ECHO request should wait for a reply from the host. The fallback (optional) parameter default : true tells the method to fall back to DEEPSCAN if no host replied to the UDP broadcast messages. The broadcast_timeout (optional) parameter default : 500 specifies how much time in milliseconds the UDP broadcast messages should wait for replies.
min_port and max_port must be within the port range 0-65535. min_port and max_port are included in the port range. This method does exactly the steps detailed in the General Information section. Methods scan(min_port, max_port, broadcast_timeout = 500, fallback = true, icmp_timeout = 50, packet_timeout = 500) Starts the scan for the hosts that have services in the min_port-max_port port range You need to bind your listeners to the proper events first depending on your logic, then call the API methods. Usage import from 'react-native-lanscan' Īll the found hosts are returned via event emitter. Then in the same file add the import statement :. In your app's MainActivity.java file, add new LANScanReactModule() to the return statement of the getPackages() function. Open your app's adle file and add the following line to the dependencies block. Project(':react-native-lanscan').projectDir = new File(settingsDir, './node_modules/react-native-lanscan/android')Ĭhange the include line of your project's adle to include the :react-native-lanscan project. Once the services are found, you can then initialize a socket connection to those services using the awesome react-native-udp package or its fork the react-native-tcp package by Andy Prock depending on your needs.Īdd the following line to the bottom of your project's adle file. Keeps sending datagram UDP packets to each connected host on the same port range and keeps waiting for replies. there isn't much we can do, is there ? :D) (This only works if the switch is not blocking ICMP requests. The DeepScan consists of sending ICMP ECHO requests to the list of the possible network IPs that was calculated before. So if you choose to do so, the package falls back to a DeepScan. If it does not find any hosts, either there aren't any or the switch is blocking subnet broadcast packets.
Keeps sending datagram UDP packets to the subnet broadcast IP address and the port range of your choosing, and keeps waiting for hosts on the subnet to respond for a specified timeout.Calculates the list of the possible IP Addresses on the network using the fetched device IP address and netmask.And this is where react-native-lanscan comes in handy. But there are switches and routers that tend to block mDNS Registry and Discovery. Take a look at the awesome react-native-zeroconf package by Balthazar Gronon. There are more suitable ways of finding services on the local network like mDNS of the Zero-configuration standard (implementations like Avahi, Bonjour or NSD). Please keep in mind that this is a fallback method. Use the React Native official NetInfo API. Please take your precautions and check if the device is connected to the network with Wi-Fi first as this package doesn't do that for you. This package scans the LAN network of the device via Wi-Fi and searches for hosts with services on a port range of your choosing.
So no need to add the permission to your app module AndroidManifest. On android, this package adds another request for the _WIFI_STATE permission for your app in the package manifest.
APP LANSCAN FREE
Feel free to submit a PR of an iOS port I'll be happy to merge ! :) Permissions
APP LANSCAN ANDROID
This package is only supported on android devices, since I'm not much of an iOS Developer. A React Native library for scanning LAN IPs and ports to find services via device Wi-Fi Support