Pb Winsock reception sous VB6

La Biode Messages postés 133 Date d'inscription jeudi 5 août 2004 Statut Membre Dernière intervention 11 août 2010 - 30 mars 2006 à 19:47
La Biode Messages postés 133 Date d'inscription jeudi 5 août 2004 Statut Membre Dernière intervention 11 août 2010 - 31 mars 2006 à 19:00
Salut voila j'ai un problème avec la fonction winsock sous vb6, lors de la reception d'un fichier j'ai une erreur comme quoi "le nom ou le numéro du fichier est incorrect". Voila mon code :

Private Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
Winsock.GetData Data


If Left(Data, 6) = "Taille" Then
clentotal = Int(Mid(Data, 7))
Winsock.SendData "Go"
Exit Sub
End If


If clentotal = "" Then
clentotal = "116000"
End If


If FileOpen <> False Then
Open "C:\VB6FR.DLL" For Binary Access Write As #1
FileOpen = True
ElseIf FileOpen = True Then
DoEvents
End If
cAvance = cAvance + Len(Data)
lblStatut.Caption = Int(cAvance / clentotal * 100) & "%"
If Data = "FinEnvoi" Then
Close #1
FileOpen = False
Winsock.Close
Else
Put 1, , Data L'erreur se trouve ici
End If
End Sub

Voila si vous savez comment on peut déboguer ^^.
ET si vous ne comprennez pas mon problème posez moi des questions j'essayerai d'etre plus précis.
MErci, La Biode.

6 réponses

mongol77 Messages postés 75 Date d'inscription dimanche 2 octobre 2005 Statut Membre Dernière intervention 24 juin 2007
30 mars 2006 à 20:06
quand est ce que tu décrémente clentotal ?
0
La Biode Messages postés 133 Date d'inscription jeudi 5 août 2004 Statut Membre Dernière intervention 11 août 2010
30 mars 2006 à 20:48
Escuse je comprend pas ta question? tu veux savoir où je donne la valeur a clentotal?
Si c'est de sa que tu parles sa se passe ici :

If Left(Data, 6) = "Taille" Then
clentotal = Int(Mid(Data, 7))
Winsock.SendData "Go"
Exit Sub
End If
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
30 mars 2006 à 22:53
en fait le fichier n'est jamais ouvert !









If FileOpen <strike><> False</strike> Then

Open "C:\VB6FR.DLL" For Binary Access Write As #1
FileOpen = True
Else<strike>If FileOpen = True Then</strike>
DoEvents
End If

Daniel
0
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
30 mars 2006 à 22:56
ce serait plutot le contraire:









If FileOpen Then
DoEvents
Else
Open "C:\VB6FR.DLL" For Binary Access Write As #1
FileOpen = True
End If

Daniel
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_Jack Messages postés 14006 Date d'inscription samedi 29 décembre 2001 Statut Modérateur Dernière intervention 28 août 2015 79
31 mars 2006 à 03:29
Ouh lala !!
Ne fais pas n'importe quoi !
Si jamais tu écrases le vrai VB6FR.DLL, tu vas avoir des emmerdements !
Choisis d'autres noms de fichier.

Il va falloir que approndisses : Tu ne recevras jamais le texte "FinEnvoi" tout seul. Il y aura surement la fin du fichier juste avant.
0
La Biode Messages postés 133 Date d'inscription jeudi 5 août 2004 Statut Membre Dernière intervention 11 août 2010
31 mars 2006 à 19:00
OUi je sais le fichier vb6 été comme exemple. JE vais essayer vos codes.
Merci, La biode
0
Rejoignez-nous