I’m creating a chat program. I guess i’m a bit confused as to how MSN and other chats work? Currently, i’m putting in the localhost ip address and just connecting to myself. I’m able to get my client and server programs communicating back and forth. My question is, is there a way where i can NOT ask the user for an IP address? I also manually enter in the port number of which i want both programs to connect to. Is there a way to avoid this too?
I would much rather ask the user for just a User name and password!
After a bit of research i came to know about the following:
IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
However, the line of code above returns all the machine’s IP addresses. How would i know which one to use?
I’m not that knowledgeable about IP addresses, so any background information and help would be awesome.
Chat programs use servers to find clients. When you login – you connect to this server and pass your IP address. At the same time you get addresses of other clients.
This is 2 mile view but I guess this is what you needed to know
You can use DNS or Host Names in your application.
To get your PC’s DNS name:
To get your PC’s IP address use something like this: