winsock transferir archivos ayuda

stcugat
22 de Marzo del 2005
weno señores me gustaria ke me ayudaran con mi codigo se trata de una aplicaccion que ize para poder enviar archivos por internet pero no se porque no funciona bien, me parece que el problema esta cuando recibe los datos aqui les dejo el codigo

FORMULARIO
_-----------------------

Private Sub Command1_Click()
ws.SendData "hola"
End Sub

Private Sub Command2_Click()
ws.RemoteHost = InputBox("fica el ip del pavo ke li vols enviar un arxiu", "ip", "localhost")
ws.RemotePort = InputBox("fica el port del pavo ke li vols enviar un arxiu", "port", "888")
ws.Connect
Timer1.Enabled = True
End Sub

Private Sub Command3_Click()
ws.LocalPort = InputBox("que puerto?", "local port", "888")
ws.Listen
End Sub

Private Sub Timer1_Timer()
If ws.State = "7" Then MsgBox ("estas coenctaot")
Timer1.Enabled = False
End Sub

Private Sub ws_ConnectionRequest(ByVal requestID As Long)
ws.Close
ws.Accept requestID
End Sub

Private Sub ws_DataArrival(ByVal bytesTotal As Long)
ws.GetData data
If data = "hola" Then
MsgBox ("as recibido una peticion de arxivo")
cd.ShowSave
ruta = cd.InitDir & cd.FileName
MsgBox (ruta)
ws.SendData "enviar"
Else
If data = "enviar" Then
Call envia("C:x.bmp")
Else
Call rebre(ruta, data)
End If
End If
End Sub

Private Sub ws_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox ("hi a algun error!!")
End Sub

MODULO
-----------------
Public ruta As String
Public data As String

Public Sub envia(de As String)
Dim debits As Long
Dim tmp As String
Dim i As Integer
Dim aps As String
debits = FileLen(de)
Open de For Binary Access Read As #1
tmp = Space$(25000)
For i = 1 To debits / Len(tmp)
Get #1, , tmp
Form1.ws.SendData tmp
DoEvents
Next i
tmp = Space$(debits - Loc(1))
If Len(tmp) Then
Get #1, , tmp
Form1.ws.SendData tmp
End If
Close #1

Form1.ws.Close
End Sub


Public Sub rebre(ruta As String, dades As String)
Form1.Label1.Caption = ruta
Open ruta For Output As #1
Close #1
Open ruta For Binary Access Write As #1
Put #1, , dades
Close #1
End Sub

gracias por su ayuda, mi email [email protected]