To discover other device IP:Port in same wifi netw

2019-08-28 23:33发布

I want to discover all Android devices IP and Port in same wifi network using ZeroMQ?

My app basically connect all device in same wifi network (no internet needed) and message to each other. Once ip and port I know I am send message successfully but how to know all device internet Protocol (ip) Using ZeroMQ?

1条回答
贪生不怕死
2楼-- · 2019-08-29 00:02

Principle

Part A)

Every IEEE 802.x CSMA/CD network "collision domain" ( wifi AP/SSID is such one ) has to be managed so as to work well. Thus the Address Resolution Protocol [ARP] will help you in the task to find all ISO-OSI-Layer-3 IP Addresses. Wifi Access Point [AP] host, to which all live devices register and handshake with, is the choice to start with.

HG520i> ip arp status
received 54205 badtype 0 bogus addr 0 reqst in 12105 replies 196 reqst out 14301
cache hit 63152696 (24%), cache miss 19455672 (23%)
IP-addr         Type           Time  Addr              stat iface
192.168.0.230   10 Mb Ethernet 290   00:15:af:e6:b1:79 41   enif0
192.168.0.62    10 Mb Ethernet 300   00:0c:29:98:d4:3b 41   enif0
192.168.0.55    10 Mb Ethernet 300   00:27:0e:07:c5:9e 41   enif0
192.168.0.255   10 Mb Ethernet 0     ff:ff:ff:ff:ff:ff 43   NULL
num of arp entries= 4

Part B)

Scanning all the ports on all the known IP hosts is a dumb brute force approach to the second issue.

Scanning just a subset of "reasonable" ones would save you both the time and efforts on peer-recognitions.

Using some smarter, active "visibility self-advertisement policy" will save you even more.

Solution

Decide on multi-party system architecture, whether an individual passive scan, a central/distributed proxy-assisted scan or an active self-advertisement policy will be used to build and maintain live records in a neighbouring hosts register.

ZeroMQ per-se brings you a lot of power for the smart solutions, while the dumb-force solutions would have to wait till fully fledged ZeroMQ services will be ready. Low level L2/L3-inspections will have to bring their fruit before ZeroMQ can first .bind()/.connect()

Needless to say, that uncoordinated CSMA/CD networks do not guarantee that all the L2-visible hosts will have "compatible" L3-ip-adddress ( will belong to / have the same L3-ip-network address ).

Thus you never know about all IP addresses without a truly low-level sniffer.

查看更多
登录 后发表回答