how can I get the information of computer that is connected to my computer? it's computer name and it's IP address.. I am using C# as my Programming Language
I am using cross cable to connect the two computer.
how can I get the information of computer that is connected to my computer? it's computer name and it's IP address.. I am using C# as my Programming Language
I am using cross cable to connect the two computer.
The first thing you should know is that when you connect something to an Ethernet network, crossover cable or not, the devices on this network aren't required to actually send anything. There is no message that says "Oh hi, I'm a new to this network, care to introduce me to the neighbors?"
That being said, there is usually a flurry of activity when a device is connected. On most networks, there is something called a DHCP server that sends out configuration, such as IP address, netmask, DNS server addresses, etc. Again, it isn't required that this is the configuration. Many devices are manually configured and don't use DHCP. Networks in general are not required to use DHCP. But, it is a good start.
What you need to do is a bit of packet sniffing. Basically, write software to listen for all packets coming across your network interface, and filter out for the packets you are interested in. There is a .NET wrapper for Winpcap, which is a packet capture driver for Windows. This should get you started.
Listen for packets set to the Ethernet broadcast (FF:FF:FF:FF:FF:FF
). On an IP network, you can use ARP to get the IP address of that host.
Windows network information is also sent via broadcast, if that interests you.
To get an idea of what you're looking for, download Wireshark and take a look.