1

How do I check that a device with a specific IP Address is still part of my network without searching for all the IP Addresses that I am connected to. Is it possible to ping an IP address of a connected hardware directly?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Alex Park
  • 91
  • 1
  • 4

1 Answers1

0

IP address is just an identifier, i.e. a number. Using that number you can try to reach a device that is assigned to that number by your network infrastructure (like network routers).

You say that you have some

IP Addresses that I am connected to

If you are already connected to the device's IP address using TCP, HTTP or any other protocol that has long-running connections, the easiest is to just check if that connection is alive. If you can store all your connections in a hashtable (or map/dictionary) and searching would be very quick.

If you are not really connected, a good way to solve this would be to implement a ping/pong (aka ECHO) scheme: when you send a network packet (or request) with some data and expect that data to come back to you within a reasonable time interval. This could be based on ICMP or your own custom protocol.

Alternatively you can implement a "heartbeat" scheme (or keep-alive, see also: https://serverfault.com/questions/361071/what-is-the-difference-between-keepalive-and-heartbeat , Do I need to heartbeat to keep a TCP connection open? , https://en.wikipedia.org/wiki/HTTP_persistent_connection ), where each device sends a periodic "I'm alive" packet do your side.

battlmonstr
  • 5,841
  • 1
  • 23
  • 33