title: IP addresses and port numbers C#
body: <p>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? </p>
  
  <p>I would much rather ask the user for just a User name and password! </p>
  
  <p>After a bit of research i came to know about the following: </p>
  
  <pre><code>IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());
  </code></pre>
  
  <p>However, the line of code above returns all the machine's IP addresses. How would i know which one to use? </p>
  
  <p>I'm not that knowledgeable about IP addresses, so any background information and help would be awesome.</p>