Scanning for network devices

1.4k views Asked by At

I want to scan for all devices in the local network. Then I want to further check if the discovered devices respond on a specific port, say #4000 for example. All that should happen on an iPad preferably using Swift (version 3).

Should I use a library for that job?

This document didn't help me and sadly I cannot find useful information on the internet.

Edit: I want to know how can you implement this in Swift/iOS libraries. Are there any examples, libraries, core classes where I should start?

1

There are 1 answers

3
Makketronix On

I think I may know what you are trying to ask. Your device sees the router, but doesn't know who is connected.

Read about multicast IP and broadcast IP, which is usually the highest IP address in your subnet.

Example: 192.168.1.255

As example, you make all devices listen on broadcast/multicast IP. To discover, you send a UDP message to that IP. Your router, if not configured otherwise, will forward that to the other devices.

This message can be something like "I am Mr. John, Reply to me at this Port".

That is the general idea