how we can get list of connected IP in LAN using C#
hi
I am facing difficulty in getting IP details of all connected users using the same application as is in the case of IP messenger tool which helps us find Users using the same tool on different machines.
Can anyone help me how to broadcast our IP to all connected IP's Or How to get connected IP's in same LAN network.
Thanks in advance
Status:
Open Nov 01, 2009 - 10:38 PM
application, ip, LAN
8answers
Answers
Nov 02, 2009 - 10:40 AM
Are you trying to get the IPs for a specific service, all services?
Nov 02, 2009 - 10:27 PM
Hi discord
I am trying to get IP's and associated User Name so that i can display them on my chat messanger...but i am not maintaining user database and am using udp protocol for data exchange using C#
Whenever tool is run it asks for temporary user name and associates it with the System IP.Then common chat room is displayed where in we can see all connected Users(with temp user names and there system IP's).
I need help to get these list of users on each connected system so that every user can see users available on LAN.
i tried following code
IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
but of no use..
Please Help
Nov 03, 2009 - 03:35 AM
I am establishing P2P connection...
Nov 03, 2009 - 04:57 AM
The users you are trying to get a list of, how are they connecting? If it is the users on your own program, you should be getting that info and persisting a list of users and IPs that connect to it when you receive a UDP packet. Since UDP is connectionless, your protocol for you tool, may need to send the IP and User name every time in the UDP data.
Nov 03, 2009 - 06:28 AM
Hi Discord
Thanks for your response again.
Right now I am entering IP in text box manually ... how to get System IP of the same machine in textbox..Please provide the required code,if possible, to automatically get current system ip in textbox
Nov 03, 2009 - 06:39 AM
String strHostName = DNS.GetHostName();
IPHostEntry ipEntry = DNS.GetHostByName(strHostName);
IPAddress[] addresses = ipEntry.AddressList;
Nov 03, 2009 - 08:03 AM
Thanks Man...Now i know what was wrong....u r a life saver
Nov 03, 2009 - 08:04 AM
Your welcome
Answer this question
Share Your Own Experience & Expertise
We look to ensure that every question is answered by the best people with relevant expertise and experience, the best answers include multiple perspectives. Do you have relevant expertise or experience to contribute your answer to any of these commonly asked questions?
Add New Comment