Monday, July 18, 2011

Gambas FTP Client

Introductions:
Another interesting features of this programming language is the application in networking .More functions are added such as DNS,HTTP,UDP and I' ll have a try using the FTP clients.

The purpose of this simple tutorials is to include sending files to a remote server , in this case the choice is to do it with FTP clients- for a more faster and secure sending and getting files to a remote server.

Again , I am going to document it in this simple blog.



Requirements:
Gambas2
gb.net.curl

Functions:
Async
byteorder
close
EndofFile
EndofLine
gethandle
id
password
peek
proxy
put
status
stop
tag
timeout
url
user



Methodology:


Details(1) gb.net.curl FTP components in Gambas2


Details(2) Gambas2 project properties


Details(3):Icon for FTP service



Details(4)Properties of FTP components

 















Here is the source code

'-------------------------------------------------------------------------------------------------------
'SendFTPFile(spath AS String, sDataFileName AS String)
'Sending FTP File
'-------------------------------------------------------------------------------------------------------
PUBLIC SUB SendFTPFile(spath AS String, sFileName AS String, sDataFileName AS String) '(dataFile AS String) AS Boolean

DIM myFtp AS NEW FtpClient

'myFtp.URL = "ftp://10.36.129.163/disk1/RoBook/Test2.pdf"
myFtp.URL = spath & sFileName
myFtp.User = "Cobe"
 myFtp.Password = "***********"
'myFtp.Timeout = 120
myFtp.Put(sDataFileName)

END


'-------------------------------------------------------------------------------------------------------
'GetFTPFile(sPath AS String, sDataFileName AS String)
'Receiving FTP File  FTP File
'-------------------------------------------------------------------------------------------------------
PUBLIC SUB GetFTPFile(spath AS String, sDataFileName AS String)  '(dataFile AS String) AS Boolean

DIM myFtp AS NEW FtpClient

'myFtp.URL = "ftp://10.36.129.163/disk1/RoBook/ok.pdf"
myFtp.URL = spath & sDataFileName
myFtp.User = "Cobe"
myFtp.Password = "**********"
'myFtp.Timeout = 120
myFtp.Get("/home/robook/Desktop/ShortCourses145.pdf")

END


Remarks :

Conclusions:

No comments:

Post a Comment