Le LSITGROUP n'aide pas.
Code : Tout sélectionner
Enumeration
#fichier
EndEnumeration
; ============CHANGE HERE ===================
;usenet_provider.s = "news.readfreenews.net"
;login.s=""
;password.s=""
usenet_provider.s = "europe.newsdemon.com"
login.s=""
password.s=""
Port.l = 119
; ============CHANGE HERE ===================
Global ConnectionID.l = 0
Global retour_chariot.s=Chr(13)+Chr(10)
Global nombre_groupes.l = 0
Global Dim nom_groupe.s(500000)
Global Dim index_article_1.l(500000)
Global Dim index_article_fin.l(500000)
Global liste.s = ""
Global Dim code_erreur.s(1000)
Global *Buffer.d
code_erreur(281) = "Authentication succeeded"
code_erreur(480) = "Authentication required"
code_erreur(500) = "Command Not understood"
code_erreur(501) = "Command Not supported"
code_erreur(502) = "No permission"
code_erreur(503) = "Program error, function Not performed"
code_erreur(381) = "More authentication information required"
code_erreur(482) = "Authentication rejected"
Procedure charge_liste_des_groupes()
demarre.d = 0
CreateFile(#fichier,"g:\download\test.txt")
SendNetworkString(ConnectionID, "LIST"+retour_chariot)
compte.l = 0
retour1:
*Buffer = AllocateMemory(10000)
*Buffer_charger.s = PeekS(*Buffer ,ReceiveNetworkData(ConnectionID, *Buffer , 10000))
nbr_ligne = CountString( *Buffer_charger, Chr(13))
code_retour.s = (StringField(*Buffer_charger, 1, " ") )
For i=1 To nbr_ligne
If demarre = 0
demarre = 1
Goto suite_charge_liste
EndIf
liste = (StringField(*Buffer_charger, i, Chr(13)) )
liste$= Mid(liste,2,Len(liste))
If FindString(liste,Chr(10) + Chr(46),0)
CloseFile(#fichier)
ProcedureReturn compte
EndIf
WriteString(#fichier,liste)
nom_groupe(compte) = StringField(liste,1," ")
index_article_fin(compte) = Val(StringField(liste,2," "))
index_article_1(compte) = Val(StringField(liste,3," "))
compte + 1
suite_charge_liste:
Next i
FreeMemory(*Buffer)
Goto retour1
EndProcedure
Procedure liste_contenu_group()
nom_group.s="fr.comp.sys.atari "
SendNetworkString(ConnectionID, "GROUP " + nom_group + retour_chariot)
; ab.d= ReceiveNetworkData(ConnectionID, *Buffer.d , 100000)
b.s = PeekS(*Buffer,ReceiveNetworkData(ConnectionID, *Buffer.d , 100000))
code_erreur$ = (StringField(b.s, 1, " ") )
nbr_article$ = (StringField(b.s, 2, " ") )
premier_art$ = (StringField(b.s, 3, " ") )
dernier_art$ = (StringField(b.s, 4, " ") )
; Debug nom_group
; Debug "code erreur "+code_erreur$ ; si 211 tout vas bien sinon erreur si code =
; Debug "nombre d'article dans le groupe "+ nbr_article$
Debug "index du premier article "+premier_art$
Debug "index du dernier article "+dernier_art$
EndProcedure
If InitNetwork() = 0
MessageRequester("Error", "impossible d'initialiser le reseau", 0)
End
EndIf
ConnectionID = OpenNetworkConnection(usenet_provider, Port)
If ConnectionID
;;;;;;;;;;;;;;;;;;;;
; AUTHENTIFICATION ;
;;;;;;;;;;;;;;;;;;;;
*Buffer = AllocateMemory(10000000)
PeekS(*Buffer,ReceiveNetworkData(ConnectionID, *Buffer , 10000000))
SendNetworkString(ConnectionID, "AUTHINFO USER "+login+retour_chariot)
FreeMemory(*Buffer)
*Buffer = AllocateMemory(10000000)
ab.d= ReceiveNetworkData(ConnectionID, *Buffer , 10000000)
b.s = PeekS(*Buffer,ab)
code_retour.s = (StringField(b, 1, " ") )
SendNetworkString(ConnectionID, "AUTHINFO PASS "+password+retour_chariot)
FreeMemory(*Buffer)
*Buffer = AllocateMemory(10000000)
ab = ReceiveNetworkData(ConnectionID, *Buffer , 10000000)
b = PeekS(*Buffer,ab)
code_retour = (StringField(b, 1, " ") )
If Val(code_retour) <> 281
CloseNetworkConnection(ConnectionID)
MessageRequester("Desolé","l'authentification a échouée : " + Chr(10) + Chr(13) + code_erreur(Val(code_retour)))
End
EndIf
FreeMemory(*Buffer)
nom_group.s="alt.binaries.games.dox "
SendNetworkString(ConnectionID, "GROUP " + nom_group + retour_chariot)
*Buffer = AllocateMemory(100000)
b = PeekS(*Buffer,ReceiveNetworkData(ConnectionID, *Buffer.d , 100000))
; Debug b
code_erreur.s = (StringField(b.s, 1, " ") )
nbr_article.s = (StringField(b.s, 2, " ") )
premier_art.s = (StringField(b.s, 3, " ") )
dernier_art.s = (StringField(b.s, 4, " ") )
Debug "index du premier article "+ premier_art
Debug "index du dernier article "+dernier_art
FreeMemory(*Buffer)
corp=0
premier_art = "1170000"
Debug "''''''''''''''''''''"
*Buffer = AllocateMemory(200000)
CreateFile(#fichier,"g:\download\headers.txt")
For i.l = Val(premier_art) To Val(premier_art) + 3
SendNetworkString(ConnectionID, "HEAD " + Str(i) + retour_chariot)
ReceiveNetworkData(ConnectionID, *Buffer , 20000)
b.s = PeekS(*Buffer,-1,#PB_Ascii )
code_erreur = (StringField(b.s, 3, " ") )
; Debug code_erreur
; Debug b
; FreeMemory(*Buffer)
If StringField(b, 1, " ") = "430"
Goto finnext
EndIf
WriteString(#fichier, b)
WriteString(#fichier,"*********************")
If FindString(b,"Subject: ",0)
Debut.l = FindString(b,"Subject: ",0) +9
fin.l = FindString(b,Chr(13) + Chr(10), FindString(b,"Subject: ",0))
Debug Mid(b, debut , fin-debut)
EndIf
; Debug Str(i)
finnext:
Next i
CloseFile(#fichier)
Debug "*******************************"
CreateFile(#fichier,"g:\download\headers2.txt")
For i.l = Val(premier_art) To Val(premier_art) + 3
SendNetworkString(ConnectionID, "HEAD " + Str(i) + retour_chariot)
ReceiveNetworkData(ConnectionID, *Buffer , 20000)
b.s = PeekS(*Buffer,-1,#PB_Ascii )
code_erreur = (StringField(b.s, 3, " ") )
; Debug code_erreur
; Debug b
; FreeMemory(*Buffer)
If StringField(b, 1, " ") = "430"
Goto finnext2
EndIf
WriteString(#fichier, b)
WriteString(#fichier,"*********************")
If FindString(b,"Subject: ",0)
Debut.l = FindString(b,"Subject: ",0) +9
fin.l = FindString(b,Chr(13) + Chr(10), FindString(b,"Subject: ",0))
Debug Mid(b, debut , fin-debut)
EndIf
; Debug Str(i)
finnext2:
Next i
CloseFile(#fichier)
EndIf
La derniere portion de code charge les HEADER du message N° 1170000 et les 3 suivants.
J'ai dupliquer le chargement des HEADER pour voir, et il ne sort pas la meme chose, alors que le code est 100% identique.
Je seche totalement depuis 2 jours, et je ne trouve aucune aide sur aucun forum.