Condition of the site

Condition of the site

Postby Natter » 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 ?
Natter
 
Posts: 1222
Joined: Mon May 14, 2007 9:49 am

Re: Condition of the site

Postby karinha » Wed Dec 07, 2022 12:40 pm

Try this,

Code: Select all  Expand view  RUN

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
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Condition of the site

Postby Natter » Thu Dec 08, 2022 6: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" )
Natter
 
Posts: 1222
Joined: Mon May 14, 2007 9:49 am

Re: Condition of the site

Postby karinha » 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
User avatar
karinha
 
Posts: 7831
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], jmartial and 84 guests