title: Detecting which IP address is receiving socket traffic
body: <p>How can I detect which IP address is receiving an incoming packet when my windows service code works on multiple IP addresses on a public server?</p>
  
  <p>I'm using an <code>UdpSocket</code> to listen incoming packets.</p>
  
  <p>This is my server application code:</p>
  
  <pre><code>ServerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
  EndPoint ServerEndPoint =   new IPEndPoint(IPAddress.Any, 5000);
  ServerSocket.Bind(ServerEndPoint);
  ServerSocket.BeginReceiveFrom(_arrReceivedDataBuffer, 0, BUFSIZE - 1, SocketFlags.None, ref ServerEndPoint, DoReceiveFromClient, ServerSocket);
  
  private void DoReceiveFromClient(IAsyncResult AsyncResult)
  {
              _ClientSocket = (Socket)AsyncResult.AsyncState;
              EndPoint ClientEndPoint = new IPEndPoint(IPAddress.Any, 0);
  
              int intMsgLen = _ClientSocket.EndReceiveFrom(AsyncResult, ref ClientEndPoint);
  
              String strMessage = "Hello From Server!"
              byte[] arrData = Encoding.ASCII.GetBytes(strMessage);
              ServerSocket.SendTo(arrData, arrData.Length, SocketFlags.None, _ClientSocket);
  }
  </code></pre>