IsServerUp funzione in LS

TIPS DEVELOPERS

  • 0 commenti
Sempre in rete ho trovato questa FUNCTION che permette di verificare se il SERVER al quale si è collegati è alzato o meno.
La routine controlla se il file LOG.NTF esiste ed ha una valida ReplicaID, allora significa che il server è in PIEDI altrimenti no.
Ecco la funzione:

********************************************
unction IsServerUp(session As NotesSession, serverName As String) As Boolean
  On Error Goto BubbleError
  ' Return TRUE if the remote server is up, FALSE if it is down
  Dim db As NotesDatabase
  On Error Resume Next
  Set db = session.GetDatabase(serverName, "log.ntf")
  If Not db Is Nothing Then
     If Not db.IsOpen Then Call db.Open("", "")
     ' Every once in a while Notes returns an invalid database as a valid
     ' database with a string of zeros as the replica id. Check for that.
     If db.ReplicaID = String$(Len(db.ReplicaID), "0") Then Set db = Nothing
  End If
  On Error Goto BubbleError
  If Err <> 0 Or db Is Nothing Then
     Err = 0
     IsServerUp = False
  Else
     IsServerUp = True
  End If
  Exit Function
BubbleError:
  Error Err, Error$ & Chr$(10) & " in procedure " & Getthreadinfo(1) & ", line " & Cstr(Erl)
End Function
********************************************

0 Commenti:

    Nessun Commento Trovato
Commenta articolo
 

Questo spazio web è stato creato da per un uso pubblico e gratuito. Qualsiasi tipo di collaborazione sarà ben accetta.
Per maggiori informazioni, scrivete a info@dominopoint.it

About Dominopoint
Social
Dominopoint social presence: