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:

Wednesday, July 6, 2011

Creating diretory in Gambas2 (Two)


Creating diretory in Gambas2

Introductions:
Hello here we are again, our next tutorials are the File & Directory functions available in Gambas2.It allows the flexibility of Gambas2 in manipulating files and its directories.Below are the list of the current features available in Gambas2 :

Requirements:

Access Tests the access authorization of a file.
COPY Copy a file.
DFree Returns the free space on a device.
Dir Browses a directory.
Exist Checks if a specific file or directory exists.
IsDir Returns if a path points at a directory.
KILL Removes a file.
LINK Creates a symbolic link.
MKDIR Creates a directory.
MOVE Renames or moves a file or a directory.
RDir Browses a directory recursively.
RMDIR Removes an empty directory.
Stat Get information about a file.
Temp$ Makes temporary file names.


Methodology:
1) Create a sample program
2) Choose 1 functions
3) Give examples
4) Discuss the output

Detail(1):Title project


Detail(2) : Create a form


Detail(3) A simple source code

Detail(4)


Detail(5) Run the program "File Directory"



Remarks:


Conclusions: