> good evening, > > i am redirecting a question to you again: > > ---- > this time it's about the FTPClient class. after some research and tries > i managed it to upload a file from a pc to a specified directory on an > ftp server and to download a file from the ftp server to pc. > > 1. problem: > the events FTPClient_Read(), _Connect() or _Error() don't raise. > > 2. problem: > it also interests how to display the messages shown in the console in > the program > > the source code follows. to test it successfully one has to change the > ftp user data. > > SOURCE CODE: > > ' Gambas class file > > PUBLIC SUB Form_Open() > > FMain.Center > FMain.Border = 1 > > END ' Form_Open() > > PUBLIC SUB btnFileDownLoad_Click() > DIM s AS String > > oFTPClient.URL = "www.sekundarschuleosterburg.de/AAA/db.css" ' source > ---> path to the original file on the ftp server > oFTPClient.User = "w00c1898" > oFTPClient.Password = "f1#skso" > oFTPClient.Get("/home/hans/db.232") ' destination, local path (save > as...) on the pc > TextArea1.Insert(oFTPClient.Status & gb.NewLine) > > END ' btnFileDownLoad_Click() ---> GET > > PUBLIC SUB btnFileUpLoad_Click() > > oFTPClient.URL = "www.sekundarschuleosterburg.de/abc.123" ' > destination ---> path on the ftp server > oFTPClient.User = "w00c1898" > oFTPClient.Password = "f1#skso" > oFTPClient.Put("/home/hans/abc.txt") ' source, path to the original > file on the pc > TextArea1.Insert(oFTPClient.Status & gb.NewLine) > > END ' btnFileUpLoad_Click ---> PUT > > PUBLIC SUB Form_Close() > > IF oFTPClient.Status = Net.Connected AND oFTPClient.Status <> > Net.ReceivingData THEN > oFTPClient.Close > ENDIF > > END ' Form_Close() > > PUBLIC SUB oFTPClient_Connect() > IF oFTPClient.Status = Net.Connecting THEN > TextArea1.Text = "Es wird ..." & gb.NewLine > ENDIF > END > > PUBLIC SUB oFTPClient_Read() > DIM sAntwort AS String > > TextArea1.Insert(oFTPClient.Status & gb.NewLine) > 'IF oFTPClient.Status = Net.Connected THEN > 'oFTPClient.Peek > 'READ #oFTPClient, sAntwort, Lof(oFTPClient) > LINE INPUT #LAST, sAntwort > 'READ #LAST, sAntwort, -256 > TextArea1.Text = TextArea1.Text & sAntwort > Label1.Caption = sAntwort > 'ENDIF > > 'TextArea1.Insert("Verbunden" & gb.NewLine) > > END > > PUBLIC SUB oFTPClient_Error() > > TextArea1.Insert("FEHLER!" & gb.NewLine) > > END > > any help is appreciated. > ---- > > regards, > tobi >
The Read event is raised in asynchronous mode only, i.e. if the Async property has been set. The FtpClient apparently never raise the Connect event. When should that event be raised? The Error event should be raised as soon as there is an error. I don't understand your english sentence in the point #2. And finally, please send a full project when some problem must be reproduced. Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user