title: How can I get the IP of the client that is sending request?
body: <p>Well I am new to this and I don't know how to do it, so my senior fellows please help!!!!</p>
  
  <p>There is a situation described below:</p>
  
  <p>An HTTP client is sending a request (Request can be of any type, not concerned regarding the request type) that directly hits a Loadbalancer. The Loadbalancer then redirects the traffic, based on the load of the traffic, towards a "Gateway" system running in two V440 Server, GW logic is written in Java, that actually logically routs this request towards another two server nodes which actually process the request.</p>
  
  <p><a href="https://i.stack.imgur.com/eTlvN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eTlvN.png" alt="enter image description here"></a></p>
  
  <p>Now the scene is something like that: there are several parallel connections are established with this Gateway from several HTTP clients. One connection per client. It has been observed that, while making connections to this GW, in case of some clients the CPU utilization is going 98-99%.</p>
  
  <p>Client is creating one connection with the GW on particular port. Opens a socket connection:</p>
  
  <pre><code>ServerSocket _ss = new ServerSocket(_port);
  Socket s = _ss.accept();
  </code></pre>
  
  <p>and then GW waits for the input to come from the client.</p>
  
  <p>Now my question is:</p>
  
  <ol>
  <li><p>Why this kind of situation is happening, as it seems all fine 
  for rest of the clients and there connections. 
  Only few clients who are creating connections with the GW is making the situation?</p></li>
  <li><p>Is there anyway we can track this client's IP so that we can understand if this 
  has been occurred by same clients every time?</p></li>
  <li><p>Is there any resolution for this?</p></li>
  </ol>