0% found this document useful (0 votes)
30 views3 pages

Loma IQ4

Uploaded by

Matías Errecart
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views3 pages

Loma IQ4

Uploaded by

Matías Errecart
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Dim Tiempo

Dim Datos() As String

Private Sub Command1_Click()


Timer1.Enabled = False
If (Winsock2.State = 0 Or Winsock2.State = 6) Then
Winsock2.Close
demora
Winsock2.Connect
End If

TiempoInicio = Timer
Do While (Winsock2.State <> 7)
If Salir = True Then End
DoEvents
If Timer >= TiempoInicio + 10 Then
Timer1.Enabled = False
a = MsgBox("Falla comunicacion!!!", vbOKOnly)
End
End If
Loop

If (Winsock2.State = 7) Then
demora
cadena = Chr(2) & "RunX=3" & Chr(3)
Winsock2.SendData cadena
End If
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()


Timer1.Enabled = False
If (Winsock2.State = 0 Or Winsock2.State = 6) Then
Winsock2.Close
demora
Winsock2.Connect
End If

TiempoInicio = Timer
Do While (Winsock2.State <> 7)
If Salir = True Then End
DoEvents
If Timer >= TiempoInicio + 10 Then
Timer1.Enabled = False
a = MsgBox("Falla comunicacion!!!", vbOKOnly)
End
End If
Loop

If (Winsock2.State = 7) Then
demora
cadena = Chr(2) & "RunX=4" & Chr(3)
Winsock2.SendData cadena
End If
Timer1.Enabled = True
End Sub

Private Sub Form_Load()


Winsock1.RemoteHost = "192.168.9.94"
Winsock1.RemotePort = "10005"
Winsock2.RemoteHost = "192.168.9.94"
Winsock2.RemotePort = "10005"

End Sub

Private Sub Timer1_Timer()


If (Winsock1.State = 0 Or Winsock1.State = 6) Then
Winsock1.Close
Winsock1.Connect
End If

TiempoInicio = Timer
Do While (Winsock1.State <> 7)
If Salir = True Then End
DoEvents
If Timer >= TiempoInicio + 10 Then
Timer1.Enabled = False
a = MsgBox("Falla comunicacion!!!", vbOKOnly)
End
End If
Loop

If (Winsock1.State = 7) Then
demora
'cadena = "#10C#" '& Chr(2) 'Chr(2) & 10C & Chr(3)---#
cadena = Chr(2) & "RunX=3" & Chr(3)
Winsock1.SendData cadena
End If

End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)


Contador = 0
Winsock1.GetData byttemp
Winsock1.Close
cadena = ""
For t = 1 To UBound(byttemp)
cadena = cadena & Chr(byttemp(t))
Next t
'If Len(cadena) > 30 Then
' Datos = Split(cadena, Chr(31))
' Label4.Caption = Datos(4)
' Label2.Caption = Datos(13)
' Label3.Caption = Datos(14)
' Label5.Caption = Datos(28)
Open "Respuesta.txt" For Append As #1
'Print #1, Time, Datos(4), Datos(13), Datos(14), Datos(28)
Print #1, Time, cadena
Close
Label2.Caption = Val(Label2.Caption + 1)
' End If
End Sub

Public Sub demora()


inicio = Timer
Do While Timer < inicio + 0.1
DoEvents
Loop
End Sub

You might also like