Ftp Problem

Blitz3D Forums/Blitz3D Beginners Area/Ftp Problem

Skurcey(Posted 2004) [#1]
I got a problem while uploading a file, i can't do it....
nip=CountHostIPs("")
hip=HostIP(1)
Global adr$=DottedIP$(hip)
file=ReadFile("nom.cfg")
If file=0 Then:nom$=Input("Nom>"):nomf=WriteFile("nom.cfg")
WriteLine(nomf,nom$):Else:nom$=ReadLine$(file):EndIf
file=WriteFile("host.ip")
WriteLine(file,adr$)
CloseFile(file)

;site$="ftp.eurower.net"
;site_pseudo$="newearth"
;site_passe$="russian"
site$="ftp.membres.lycos.fr"
site_pseudo$="Skurvy"
site_passe$="ftpftp"

Global ftp,ftp_n,ftp_msg$
m=MilliSecs()
ftp=OpenTCPStream (site$,21)
get_msg()
WriteLine(ftp,"USER "+site_pseudo$)
get_msg()
WriteLine(ftp,"PASS "+site_passe$)
get_msg()
WriteLine ftp,"CWD ip"
get_msg()
WriteLine ftp,"PASV"
get_msg()
ftp_put()

Print MilliSecs()-m+" (ms) Temps d'acces"
Function get_msg()
rl$=ReadLine$(ftp)
ftp_n= Left$(rl$,3)
ftp_msg$=Mid$(rl$,5,Len(rl$))
Print ftp_msg$
Print ftp_n
End Function

Function ftp_put()
nb=(Len(adr$))
file=OpenFile("host.ip")
bank=CreateBank(17)
bytes=ReadBytes(bank,file,0,17)
Print "Bytes:"+bytes
WriteLine ftp,"STOR host.txt"
WriteBytes bank,ftp,0,17
get_msg()
Print "----"+bank
end function
--------------------------------------------------------
It s for an online game we don't have a server or a static ip so it can upload the ip of the hoster, or do you think there's a better way?, Thanks