0

There are many similar questions to my question but none of them answers exactly what I need, so I am putting up here the detailed scenario and architecture / layout:

       ___________
      |           |
      |    PC     |
      |           |
      |___________|
            |
       _____|_____
      |  switch   |
      |___________|
        |    |   |
    ____|    |   |_____> Hanging Cable
   |         |                               
   |         |
 Device1   Device2

Device1, Device2 are biometric devices which are connected to PC via switch.
Each device has its MAC address and private IP address.

Now the question is:

Is there any way to determine MAC address or IP address of Device3 when connected to Hanging Cable instantly in C# .NET as shown in figure?

Ping method takes a little time to figure out whether given IP is connected.

I want to determine MAC or IP of the device instantly when it is connected because, I have to synchronize some data with the device and for that I have written a thread which has a loop detecting devices and as soon as device found then it performs synchronization.
If I use Ping to determine connection then the thread takes a more time and the delay is propagated to further devices which are there in loop.

The application at PC has a list of all devices MAC address as well as the private IP address. The only thing PC doesn't know is when a device is going to be connected so as to synchronize data.

Utkarsh
  • 318
  • 2
  • 9
  • Why doesn't the device just specify its MAC address (or some other device identifier) in its synchronization protocol? – Jon Skeet May 01 '14 at 08:31
  • AFAIK, there is no event driven notification that lets Windows PCs on a network to be informed about new devices being added to the network. When you click on Network icon, it always takes a few seconds for your PC to enumerate other devices on the network as it doesn't pro-actively maintain a list. However, if you are on a domain based network then you could always query Active Directory for a full list quite quickly. – Chris Walsh May 01 '14 at 08:38
  • "instantly" is hard, how much of a delay are you seeing now/can you tolerate? – Joachim Isaksson May 01 '14 at 08:39
  • But the program at PC is not aware of the device and for the same purpose, I wish to know the MAC or IP for synchronization – Utkarsh May 01 '14 at 08:40
  • Doesn't this answer your question? http://stackoverflow.com/questions/2873500/automatically-detect-a-new-computer-connected-to-the-network – tia May 01 '14 at 08:44
  • Sir Joachim, the scenario is like, a teacher is going to connect device to cable for synchronization of biometric attendance so I wanted to make the thread such that it takes least possible time to detect device and synchronize. – Utkarsh May 01 '14 at 08:53
  • Sir Tia, the post is what I am looking for. But when I run arp -a, it does not show the MAC address / IP at the very moment. But I have to wait for some time then if I run arp -a, it shows the MAC and IP. – Utkarsh May 01 '14 at 08:56
  • Sir Chris, could you please explain querying Active Directory or share a link explaining the process? – Utkarsh May 01 '14 at 08:59
  • I went through certain other posts of stackoverflow as also mentioned by Sir Joachim Isaksson, MAC table can be fetched from switch, and switch updates MAC table every 250 ms. So can I use this approach to find whether a known MAC is there in the MAC table of switch? – Utkarsh May 01 '14 at 09:05
  • @Utkarsh To avoid turning this into a brainstorming session, maybe you could clarify your question a little? Do you need the IP or the MAC address for synchronizing the devices? Do you have control over the software on the devices or just the PC? Any more information that is useful to answer the question? – Joachim Isaksson May 01 '14 at 09:12
  • Yes sir, I have a database which has 2 attributes one contains IP address second contains MAC address. So if either of them is available, the purpose will be solved. – Utkarsh May 01 '14 at 09:20

0 Answers0