Главная страница | назад





Article #19714: Detecting at runtime whether or not you are connected to the internet.

 Question and Answer Database

     FAQ: FAQ4714C - Detecting at runtime whether or not you are connected to the internet.
Category: Internet/WEB
Platform: All-32Bit
 Product: C++Builder3.x,   C++Builder4.x,   

Question:

How can I tell at runtime if I am connected to the internet?


Answer:

You can use the NetMasters Powersock component to retrieve the Local IP 
address. If it is "0.0.0.0" then there is no connection.

Example:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    if (Powersock1->LocalIP == "0.0.0.0")
        ShowMessage("not connected");
    else
        ShowMessage(Powersock1->LocalIP);
}

8/4/99 11:55:54 AM
 

Last Modified: 01-SEP-99