title: How do I get the IPv4 from a ServerSocket?
body: <p>In my app, I create a <code>ServerSocket</code>, and wait for connections:</p>
  
  <pre><code>while(isRunning) {
      try {
          socket = serverSocket.accept();
  </code></pre>
  
  <p>I then try to get the remote IP of the resulting socket:</p>
  
  <pre><code>socket.getInetAddress().getHostAddress();
  </code></pre>
  
  <p>However, this seems to only return an IPv6 address.</p>
  
  <p>For my purposes, I believe I need an IPv4. Is there some way to get an IPv4 address from a socket?</p>