FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Condition of the site
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Condition of the site
Posted: Wed Dec 07, 2022 10:07 AM

Hi,

In the process of work, I turn to a certain site. Sometimes this site may not work or work very slowly. Is it possible to assess the condition of the site ?

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Condition of the site
Posted: Wed Dec 07, 2022 12:40 PM
Try this,
Code (fw): Select all Collapse
FUNCTION Verify_Site()

   LOCAL cIp, cVret := .F.

   WsaStartUp()

   cIp := GETHOSTBYNAME( "yoursite.com" )
   cIp := GETHOSTBYNAME( "yoursite.com" )

   WsaCleanUp()

   // Seguranca caso o provedor da microsoft esteja fora do ar...
   IF ( cIp <= "0.0.0.0" )

      ? "oooops!"

      WsaStartUp()

      cIp := GetHostByName( "otrosite.com" )
      cIp := GetHostByName( "otrosite.com" )

      WsaCleanUp()

   ENDIF

RETURN( cIp<>"0.0.0.0" )
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Condition of the site
Posted: Thu Dec 08, 2022 06:47 AM

Thank you, Karinha, it works!

What are the WSAStartup/Wsacleanup functions for in this case?

Why prescribe 2 times:

cIp := GETHOSTBYNAME( "yoursite.com" )

cIp := GETHOSTBYNAME( "yoursite.com" )

Posts: 8515
Joined: Tue Dec 20, 2005 07:36 PM
Re: Condition of the site
Posted: Thu Dec 08, 2022 12:34 PM
Natter wrote:Thank you, Karinha, it works!
What are the WSAStartup/Wsacleanup functions for in this case?
Why prescribe 2 times:
cIp := GETHOSTBYNAME( "yoursite.com" )
cIp := GETHOSTBYNAME( "yoursite.com" )
Good Morning. This was a tip on the FiveWin Brasil forum. Just to be on the safe side, in case the GETHOSTBYNAME() command fails. OK?

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341

Continue the discussion