title: How to use Dynamic IP to request connect with socket in c#?
body: <pre><code>public void connectContent()
  {    
      client= new TcpClient();      
   
      var result=client.BeginConnect(IPAddress.Parse(&quot;192.168.1.4&quot;), 12000,null,null);  
      var success = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(1));
      
      if(success){
          Debug.Log(&quot;ok &quot;+playerID);
      } else {
          Debug.Log(&quot;fail&quot;);
      }
  }
  </code></pre>
  <p>I have a project developed for over 5 months, and it always can connect in the expected way.</p>
  <p>But today it can't connect to server, after I changed the IP <code>192.168.1.3</code> to <code>192.168.1.4</code>, it works. I don't know why and how this happen. Static IP in code seems unsafe when some outside problem happen will influence the client IP.</p>
  <p>How to use Dynamic IP rather than write the static IP in code?</p>