How can I find out IP address of the localhost?

How can I find out IP address of the localhost?

Date Entered: 09/04/1997    Last Updated: 06/07/2004

The LocalHost property shows the Windows Network name of the host if the control is not connected and the IP address of the interface through which the connection was made otherwise.

To get the address without connecting simply assign the LocalHost value to the RemoteHost and read the new value of RemoteHost (WinsockLoaded must be true for this operation with IPWorks version 3.0 or earlier).

If you want to find the dynamically assigned address when connecting to your Internet Service Provider (ISP) you should use the IPInfo control and check its OtherAddresses property as shown below:

     //resolve the LocalHost name
     IPInfo1->HostName = IPInfo1->LocalHost; 
     //let the message be dispatched
     Application->ProcessMessages;
     // show the static as well as dynamic addresses
     Memo1->Lines->Add(IPInfo1->HostAddress + " " 
+ IPInfo1->OtherAddresses);


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.