non ricordo molto bene, perchè è da tempo che non lo guardavo, ma ho fatto così...
ho creato una funzione
codice:
Function WaitTime(RispostaSRV As String, Intervall As Integer) As Boolean
Dim WaitSt As Date
WaitSt = Now()
While InStr(1, RespSRV, RispostaSRV, 1) < 1
DoEvents
If DateDiff("s", WaitSt, Now) > Intervall Then
RespSRV = ""
WaitTime = False
Exit Function
End If
Wend
'Registro l'ultima risposta del server in una variabile temporanea
RespSRVTemp = RespSRV
RespSRV = ""
WaitTime = True
End Function
che poi richiamavo...
codice:
If Not WaitTime("+OK", 10) Then
StBar.Panels(1).Text = "Timeout Connessione..."
Call cmd2_Click
Exit Sub
End If
attendevo il +OK dell protocollo per 10 secondi