Test network connection?

Post Reply
DonDrew
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Test network connection?

Post by DonDrew »

I'm having trouble with a customer application which seems to loose its network connection from time to time.

Does anyone know of a technique that will allow me to test if a workstation is still connected to a LAN?

Don
Marc Vanzegbroeck
Posts: 1102
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium
Contact:

Re: Test network connection?

Post by Marc Vanzegbroeck »

Don,

You can check if a file exist on the network-directory with IF FILE() like.

Code: Select all

IF !FILE(...)
   msgalert('Networkdrive error')
ENDIF
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Test network connection?

Post by karinha »

Code: Select all

   IF .NOT. FILE( "CADNFE.DBF" ) .OR. .NOT. FILE( "CADCESVE.DBF" ) .OR.     ;
      .NOT. FILE( "ICESVE.CDX" ) .OR. NETERR()

      ...

   ENDIF
 
Regards,
João Santos - São Paulo - Brasil
DonDrew
Posts: 63
Joined: Mon Aug 02, 2010 5:38 pm

Re: Test network connection?

Post by DonDrew »

Marc & Karinha
Thanks for your suggestions.

I've used your ideas plus a few of my own to add enhancements to errsysw.prg which I hope will help me catch possible network errors.

Thanks again.

Don
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Test network connection?

Post by karinha »

In ERRSYSW.PRG

Code: Select all

   IF .NOT. EMPTY( e:osCode )

      ? "Error in NetWork"

   ENDIF
   

Code: Select all

   IF UPPER(e:Description)="CORRUPTION DETECTED" 

      ? "Corruption Detected"

   ENDIF
   

Please, translate for ingles.

Code: Select all

   IF UPPER(e:Description) = "LOCK REQUIRED"                  .OR. ;
      UPPER(e:Description) = "TRAVAMENTO REQUERIDO"           .OR. ;
      UPPER(e:Description) = "FALHA NO TRAVAMENTO"            .OR. ;
      UPPER(e:Description) = "FALHA NO TRAVAMENTO DO APPEND"  .OR. ;
      UPPER(e:Description) = "USO EXCLUSIVO REQUERIDO"        .OR. ;
      UPPER(e:Description) = "Erro DBFCDX/1002 erro ao Abrir" .OR. ;
      UPPER(e:Description) = "Erro DBFCDX/1002 erro Open (DOS Erro 2)" .OR. ;
      UPPER(e:Description) = "Error DBFCDX/1002 Open error"    .OR.;
      UPPER(e:Description) = "Error DBFCDX/1002 Open error (DOS Error 2)" .OR.;
      UPPER(e:Description) = "(DOS Error 2) DBFCDX/1002 ERRO DE ABERTURA" .OR.;
      UPPER(e:Description) = "Erro DBFCDX/1001 erro ao Abrir"             .OR.;
      UPPER(e:Description) = "Erro DBFCDX/1001 erro Open (DOS Erro 2)"    .OR.;
      UPPER(e:Description) = "Error DBFCDX/1001 Open error"               .OR.;
      UPPER(e:Description) = "Error DBFCDX/1001 Open error (DOS Error 2)" .OR.;
      UPPER(e:Description) = "Error DBFCDX/1201 WORKAREA NOT INDEXED"     .OR.;
      UPPER(e:Description) = "ERROR DBFCDX/1201 WORKAREA NÇO INDEXADA"    .OR.;
      UPPER(e:Description) = "Error DBFCDX/1012 Corruption detected"      .OR.;
      UPPER(e:Description) = "ERROR DBFCDX/1012 CORRUPTION DETECTED"      .OR.;
      UPPER(e:Description) = "Error DBFCDX/1210 Corruption detected"      .OR.;
      UPPER(e:Description) = "ERROR DBFCDX/1210 CORRUPTION DETECTED"      .OR.;
      UPPER(e:Description) = "(DOS ERROR 64) DBFCDX/1010  ERRO DE LEITURA".OR.;
      UPPER(e:Description) = "(DOS Error 2) DBFCDX/1001 ERRO DE ABERTURA"

      ? "Error in .DBF"

   ENDIF
   
João Santos - São Paulo - Brasil
Post Reply