Hi everyone,
I am trying to connect different computers to an ad-hoc network, but every time that two computers are assigned to the same IP windows shows a conflict error message.
Is there any way to detect this error programmatically? so I can assign the latest computer added to the network to a different IP.
Thanks in advance for any help
Sam HobbsPosted Oct 27, 2011, 3:54 PM
Either the problem you are trying to solve is a common problem and there is a common solution, or there is something unique to your situation yet that part is not clear. If you can explain why your situation is different then it is more likely that someone can help you.
ToniPosted Oct 27, 2011, 4:37 AM
Thank you for your reply, unfortunately your solution only bring the IP addresses for the local computer where I execute the code. I need to find the computers connected to an ad-hoc network, so I can assign a different IP to the new computer added to this network.
Thank you for your help.
Regards,
Toni
Sam HobbsPosted Oct 26, 2011, 1:05 PM
Sam HobbsPosted Oct 26, 2011, 1:01 PM
("Select Name, Caption, DisplayType, Description from Win32_NetworkConnection");
foreach (ManagementObject nc in NetworkConnections.Get())
{
Console.WriteLine("{0} | {1} | {2} | {3}", nc["Name"], nc["Caption"], nc["DisplayType"], nc["Description"]);
}
Javeed M ShaikhPosted Oct 26, 2011, 12:10 PM
can you get the IP Addresses of all the local computer in the network and than find out if there is a duplicate and work from there.
IPAddress[] arrayOfIPAddresses = Dns.GetHostByName(Dns.GetHostName()).AddressList;
for (int i=0; i<arrayOfIPAddresses.Length; i++)
Console.WriteLine ("IPAddress[{0}]={1}",i,arrayOfIPAddresses[i]); }