Esta vez no es una duda sino un gran problema para mi, necesito entender que hace todo lo que hay en el bucle While que he puesto en negrita, para la semana que viene, (me lo van a preguntar y no entiendo porque hay esas variables data1 y data2, como funcionan, la asignación y el resto del contenido del bucle. Desde luego es importante porque a poco que lo modifico no funciona el programa.
En fin si algun alma caritativa me puede aportar algo de luz se lo agradeceria muchísimo.
(Por si a alguien le puede valer a algiuen es parte del código conexión de un cliente ftp en VB)
Un saludo.
--------------------------
Private Sub Command1_Click(Index As Integer)
Call LogOn
end Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
On Error GoTo errhandler
Dim Data1 As String, Data2 As String
Select Case State
Case icResolvingHost
lblStatus.Caption = "Looking up host computer IP address"
Case icHostResolved
lblStatus.Caption = "IP address found"
Case icConnecting
lblStatus.Caption = "Connecting to host computer"
Case icReceivingResponse
lblStatus.Caption = "Receiving a response from host"
Case icResponseReceived
lblStatus.Caption = "Response received"
Case icDisconnecting
lblStatus.Caption = "Disconnecting from host computer"
Case icDisconnected
lblStatus.Caption = "Disconnected from host computer"
Case icError
lblStatus.Caption = "Error " & Inet1.ResponseCode & Inet1.ResponseInfo
Case icResponseCompleted
lblStatus.Caption = "Request completed successfully"
Do While True
'Change datatype to icByteArray to receive data in binary
Data1 = Inet1.GetChunk(512, icString)
If Len(Data1) = 0 Then Exit Do
DoEvents
Data2 = Data2 & Data1
Loop
txtDir.Text = Data2
End Select
Exit Sub
errhandler:
MsgBox Err.Source & " " & Err.Number & " " & Err.Description
End Sub
Public Sub LogOn()
Command1(0).Enabled = False
Inet1.Protocol = icFTP
Inet1.URL = txtURL.Text
Inet1.UserName = txtUserName.Text
Inet1.Password = txtPassword.Text
Inet1.Execute , "DIR"
End Sub