
cliente...
Código
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim Buffer As String Winsock1.GetData Buffer estado.Text = estado.Text + vbCrLf + "Comando: " + Buffer estado.SelStart = Len(estado.Text) comandos (Buffer) End Sub Public Function comandos(comando As String) If comando = "screenshot" Then Picture1.Picture = CaptureScreen() SavePicture Picture1.Picture, "c:\screenshot.bmp" urlFile.Text = "c:\screenshot.bmp" Open urlFile For Binary As #1 var_DataFile = Input(LOF(1), 1) Close #1 var_DataSize = Len(var_DataFile) estado.Text = estado.Text & vbCrLf & "Enviando informacion de datos..." estado.SelStart = Len(estado.Text) Winsock1.SendData "Envio|" & urlFile.Text & "|" & var_DataSize End If If comando = "enviar" Then Call sendfile End If End Function Public Function sendfile() estado.Text = estado.Text & vbCrLf & "Enviando datos..." estado.SelStart = Len(estado.Text) Winsock1.SendData var_DataFile End Function
Servidor...
Código
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long) Dim Texto As String Dim Ruta As String Dim Peso As String Dim suma As String Dim Temporal As String Winsock1.GetData Texto If Mid(Texto, 1, 5) = "Envio" Then estado.Text = estado.Text & vbCrLf & "Solicitando informacion del archivo..." estado.Text = estado.Text & vbCrLf & Texto estado.SelStart = Len(estado.Text) Texto = Mid(Texto, 7, Len(Texto) - 5) For i = 1 To Len(Texto) If Mid(Texto, 1, 1) <> "|" Then Ruta = Ruta + Mid(Texto, 1, 1) ElseIf Mid(Texto, 1, 1) = "|" Then Texto = Mid(Texto, 2, Len(Texto) - 1) Exit For End If Texto = Mid(Texto, 2, Len(Texto) - 1) Next Peso = Val(Texto) estado.Text = estado.Text & vbCrLf & "Ruta del archivo: " & Ruta estado.SelStart = Len(estado.Text) nomFile.Text = Ruta estado.Text = estado.Text & vbCrLf & "Peso del archivo: " & Peso estado.SelStart = Len(estado.Text) pesoFile.Text = Peso estado.Text = estado.Text & vbCrLf & "Solicitando archivo..." estado.SelStart = Len(estado.Text) Winsock1.SendData "enviar" Else If Len(Temporal) <> pesoFile.Text Then Temporal = Temporal + Texto bytes.Text = Len(Texto) numSuma.Text = Val(numSuma.Text) + Val(bytes.Text) End If If numSuma.Text = pesoFile.Text Then Open nomFile For Binary As #1 Put #1, 1, Temporal Close #1 Ruta = "" estado.Text = estado.Text & vbCrLf & "El archivo se recibio correctamente..." estado.SelStart = Len(estado.Text) End If End If End Sub
segun yo, el problema esta en la parte de...
Código
Temporal = Temporal + Texto
...pero no estoy ya del todo seguro, si alguien me puede ayudar se los agradeceria muchismp
