To discover other device IP:Port in same wifi network using ZeroMQ

限于喜欢 提交于 2020-01-06 07:34:11

问题


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:


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.



来源:https://stackoverflow.com/questions/24804359/to-discover-other-device-ipport-in-same-wifi-network-using-zeromq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!