title: C# Socket connection to server app with unknown IP
body: <p>I was wondering how one would connect to a server app if you know nothing more than that it is running on the same network? The typical socket connection requires an IP address in order to connect, but what if its unknown? Is there some other way to either connect without an IP or determine the server app's IP somehow?</p>
  
  <p>I'm asking this because to me it seems quite impractical to have to hard code the server IP into the client app, or have the user manually type it in at run time? When you are on a network where IPs automatically get assigned by DHCP server, you will never know for sure what IP the server app is running on unless you give that machine a static IP, something that I want to avoid.</p>
  
  <p>I hope my inquiry is clear enough.</p>
  
  <pre><code>var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
          try
          {
              socket.Connect(serverIP, serverPort); &lt;- this line is what I want and alternate to
              client = new TGHClient(socket);
              client.Received += client_Received;
              client.Disconnected += client_Disconnected;
  
          }
  </code></pre>