Page 5 of 5

Posted: Sun Jul 17, 2005 12:59 pm
by zapman*
Congratulations, Dare2. That's a big stuff!

Posted: Sun Jul 17, 2005 6:51 pm
by TerryHough
DarkDragon wrote:
TerryHough wrote:First, which FTP_Include are you using? Mine, Zapman's, or a modified
one?
And mine? You have forgotten me! :P
Oops, sorry. Didn't mean to overlook you or Num3 who started it all.

Terry

Posted: Mon Jul 18, 2005 11:41 am
by Dare2
Thanks zapman. :)

(Big stuff or big stuff-up? ;))

Posted: Mon Jul 18, 2005 10:38 pm
by zapman*
For a small staff?

Posted: Wed Jul 20, 2005 5:43 pm
by fsw
Dare2 wrote:A framework for a client (uploaded using itself) is here:

http://www.tabturn.com/purebasic/PasvTfr.zip

The zip contains sources and an executable. The client uses winapi but the actual FTP is cross-platform based on what I learned here. The FTP part is quite different in some ways (I tried to write from ground up) but still based on and only possible because of the work here.
Thank you for this :D

BTW: It doesn't work here. Maybe because my computer is behind a proxy. What do I have to do to get it going?

Posted: Sun Jul 24, 2005 4:46 am
by Shannara
Terry, link is down, but I was able to find a recently downloaded file of it. still 0.7d .. :) Anyways, line 44 (unable to allocate memory block size of 0 ...)

Code: Select all

Global *mem.l   : *mem = AllocateMemory(Block_Size)
Block_Size is not given a value, what should go here? I actually put in 1024, though Im hoping there is no set defined value that needs to go here :)

Bah, now that I am in a debugging mood .... turns out the variable assignment was in the wrong spot, fixed :) there are a few other things im doing to this include before I post my version :) basically some bug fixes, and replace missing variables, and no gadget dependencies! :)

Posted: Mon Jul 25, 2005 3:04 pm
by TerryHough
Shannara wrote:Terry, link is down...
line 44 (unable to allocate memory block size of 0 ...)

Code: Select all

Global *mem.l   : *mem = AllocateMemory(Block_Size)
Block_Size is not given a value, what should go here? I actually put in 1024, though Im hoping there is no set defined value that needs to go here :)
Link is back up now. 7d is the last that I have posted, although I have made a few more changes since then.

Block_Size can be varied. I have used several sizes to optimize the exchange with the FTP Server. Some servers allow the setting of the block size they use too. In that case, it is more efficient if the client matches. I have not attempted to determine this automatically yet.

Strange though, I have never experienced a problem with the line you mentioned up through PB Vs 3.93. But the Block_Size assignment needs to be relocated as you figured out.

Posted: Mon Jul 25, 2005 3:14 pm
by Dare2
fsw wrote:BTW: It doesn't work here. Maybe because my computer is behind a proxy. What do I have to do to get it going?
Hi, sorry for such a long delay in answering, but was overseas. Got back a few hours ago.

Now for the answer - - - I don't have a clue. I'm basically a novice at this and what you got was my attempt to emulate the gurus here. The code doesn't even support PORT. But it does use PASV ...?

Anyway, will look at it in a few days (and find a proxy to hide behind) and see what I can see. Actually, first I'll try to find out what a proxy really is ... :)

Meantime, feel free to come up with a solution for me .. :)

Posted: Tue Mar 28, 2006 11:35 pm
by popstatic
Hi there ;)

I'm very interested in your FTP include, regrettably it won't work....
Actually it seems that your lib only allows passive mode file transferts (please tell me if I'm wrong), but I really need an active mode to get it to work on my FTP server...

I just get a "time out" error, a 0k file with the right name is created on the server but nothing else. It's really seems like both my server and my soft are waiting for something from the other and then... Time out!

I just need a ftp lib source honed to the essential (actually I just need creating a directory, changing directory and uploading a file)
Do you think that if the lib effectively only allows PASV file tranferts, I could easily implement an active way? do you have any clue?

thanks in advance.

popstatic

(great work;) )

Posted: Wed Mar 29, 2006 2:57 am
by dracflamloc
Hey cool guys, I dunno how I missed this thread before...???

=)

I'll be sure to take a look at it. I'm considering using it in my MMORPG for transferring map data more reliably.

Posted: Wed Jun 21, 2006 3:47 am
by zapman*
If anybody is still interrested by this library, you can find a new version for PB4, compatible with the Unicode option on.

It is included in my DropUpLoad Package at:
http://www.rankspirit.com/downloads/dropupload.zip

This version has been tested with hundreds of FTP Servers through the world and I thinck that I can say that it is absolutelly reliable (even if not really eleguantly coded :oops: )

It supports Active and Passive modes.

Posted: Thu Jun 22, 2006 8:26 pm
by Pantcho!!
Great zapman* !!
even more important is the reliablity!
I myself code "OK" ... meaning not super clean but my codes are working fine. so this is a major issue that it has been tested as you said in "hundreds of FTP Servers" 8)

thanks man.

Posted: Fri Jun 23, 2006 1:09 am
by Dare
Thanks zapman*


Edit: Hi zapman*, what dependencies/requirements exist/needed for the sources?

Posted: Sun Nov 05, 2006 12:34 am
by zapman*
All you need is PB4.

Here is a question by pm from Nico:
Hi

I have one question to your lib. How i can set a folder for the FTP at the FTP-Server config?

THX Nico
and the answer:


Hello Nico,

You need the FTP_ChangeDir command.

here is an example:

Code: Select all

#LFCR = Chr(13) + Chr(10)
#Refresh = 0
#BInter = 0

XIncludeFile ("FTP_Library_Include_Z5.pb")


; ___________________________________________________________
;                                     Parameters - Paramétrage
; ___________________________________________________________

Server.ServerStruct\Name = "Nom du serveur" ; Name is not important - Peu importe le nom
Server\Adress = "ftp.monsite.com/html/" ; ai.e. ftp.monsite.com/html/ - sous la forme ftp.monsite.com/html/, par exemple
Server\Login = "monlogin"
Server\Password = "monpassword"
Server\Port = 21 ; most of the servers use port#21 - la plupart des serveurs utilisent le port 21
Server\Active = 0 ; most of the servers work better in passive mode - la plupart des serveurs fonctionnent mieux en mode passif
Server\TimeOut = 10000 ; 10 seconds timout -  time out de 10 secondes (10000 millisecondes)
;
; --------------------------------------------------------------------------------------------------------
;                             Split the path and the server name
;                    On sépare le nom du serveur du chemin d'accés
pos = FindString(Server\Adress,"/",0) 
If pos = 0 : pos = Len(Server\Adress)+1 : EndIf
path$ = Right(Server\Adress,Len(Server\Adress)-pos)
If path$ = "/" : path$ = "" : EndIf
If path$ And Right(path$,1)<>"/" : path$ + "/" : EndIf ; Now, path$ contains the path -  path$ contient maintenant le chemin d'accés
Server\Adress = Left(Server\Adress,pos-1)
;
; --------------------------------------------------------------------------------------------------------

FTP_Init()
FTP_Connect(Server,0) ; open the connection - ouverture de la connection

If PortID ; PortID is a global variable which contains the number of the internal connection port - PortID est une variable globale contenant le n° du port interne affecté à la connection
  If FTP_Login(PortID, Server, 0) = #FTP_OK ; send login and password - envoi du login et du mot de passe
  
  
    While path$ ; we'll use the ChangeDir command to access to the path - On va utiliser la commande "ChangeDir" jusqu'à atteindre le répertoire indiqué par le chemin d'accés.
      pos = FindString(path$,"/",0)
      If pos = 0 : pos = Len(path$)+1 : EndIf
      dirT$ = Left(path$,pos-1)
      path$ = Right(path$,Len(path$)-pos)
      ResultCD = FTP_ChangeDir(PortID, Server, dirT$, Log_Gadget)
      If ResultCD <> #FTP_OK And ResultCD <> 550
        ResultFTPDIR$ = "!!Error while opening the directory!! "+dirT$+" ("+Str(ResultCD)+")"
        Debug ResultFTPDIR$
      ElseIf ResultCD = 550
        Answ = MessageRequester("FTP",dirT$+" does'nt exist. Do you want to create it?",#PB_MessageRequester_YesNo)
        If Answ = 6
          If FTP_MakeDir(PortID, Server, dirT$, 0) = #FTP_OK
            If FTP_ChangeDir(PortID, Server, dirT$, 0) <> #FTP_OK
              ResultFTPDIR$ = "!!Error while opening the directory!! "+dirT$
              Debug ResultFTPDIR$
            EndIf
          Else
            ResultFTPDIR$ = "!!Error while creating the directory!! "+dirT$
          EndIf
        EndIf
      EndIf
    Wend
    ;
    ;
    ; If all is OK, we are now inside the good server repertory
    ; Si tout s'est bien passé, nous sommes à présent connecté et positionné dans le bon dossier du serveur
    ; 
    ; We can do (as an example):
    ; On peut faire, par exemple :
    ;
    ;File_to_upload$ = "c:\\myfile.txt" ; <----------- put here the name of the file to upload
    ;ProgBarGadgetID = My_Gadget ; <----------- put here the # of the progression bar gadgetn
    ;FTP_Store(PortID, Server, File_to_upload$, ProgBarGadgetID.l, 0)
    
    ;Fichier_a_uploader$ = "c:\\monfichier.txt" ; <----------- entre ici le nom du fichier que tu veux uploader
    ;ProgBarGadgetID = Mon_Gadget ; <----------- entre ici le N° du gadget qui fait barre de progression
    ;FTP_Store(PortID, Server, Fichier_a_uploader$, ProgBarGadgetID.l, 0)
    
   ; Or simply - Ou simplement
   Result = FTP_List(PortID, Server,"", DList.DirList, 0) ; to get the repertory content - pour obtenir le contenu du répertoire
   Debug DList\DirectoryList
   ;

  
    FTP_Logout(0)
    PortID = 0
    
  EndIf
EndIf