bilmaa
9th October 2008, 11:55
I need to create one ftp conection, and use the ftp command.
the scrip is this:
ret_val = ftp.init()
if (ret_val = 0) then
Ftp.Connect("hostname", connection)
endif
if (ret_val = 0) then
ret_val = ftp.login("user","password",connection)
endif
when the program call "ftp.connect" the conectión with bshell is broken and
in the Event viewer appear this:
Env BaanIV (e:\baan)
Prog bshell file \general\lib\al_1\al_wutil.c # 607
Keyword Stack trace
Username esbaand type S language 5
Process 0x2924
Lasterror 0
Errno 0
bdberrno 509 (Bad memory cursor; bad table pointer specified)
Message Exception C0000005 (Access violation)
FtpConnect+D3 (1:000fc2e3)
1:000cc6bf
1:00090995
1:00000998
1:000f82a9
ProcessIdToSessionId+209 (1:0002e23b)
what`s the solutión to this error?????
thanks in advantage.
_Ralph_
9th October 2008, 19:34
"hostname" anb connection are arguments.
You must specify then before call the function...
something like
ret = ftp.connect("100.0.50.125", connection)
or
string hostname
hostname = "ftp.baan.com"
ftp.connect(hostname, connection)
:o
_Ralph_
9th October 2008, 22:20
The most recent Programmers Guide do not have this functions related
Extracted From:
Title Infor ERP LN 6.1 Programmers Guide
Version 7.6.0 2453
Publication date 9/26/2007 9:23:23 PM
Next code is a sample about how to connect to a remote host.
function void main()
{
long ret_val
long connection
long secondconnection
string response(500)
| all next functions return 0 upon success, non-zero on
failure.
| the connection identifier, retrieved during ftp.connect need
to be used in every subsequent call to an ftp function
| provided functionality by ftp deamon varies per platform,
e.g. some commands are not understood, or ascii transfer of files
is not possible
| you have to find out yourself what the ftp daemon provides as
functionality.
| ftp.last.response usually tells a detailed cause for a
problem.
| ftp.init function need to be called before any other ftp
function, otherwise the other ones will fail.
ret_val = ftp.init()
if (ret_val = 0) then
ret_val = ftp.connect("hostname", connection)
endif
if (ret_val = 0) then
ret_val = ftp.login("anonymous","yourmailddress",
connection)
endif
| open a second connection
if (ret_val = 0) then
ret_val = ftp.connect("otherhostname", secondconnection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(secondconnection, response)
endif
if (ret_val = 0) then
ret_val = ftp.quit(secondconnection)
endif
| errorneous calls (connection is already closed, but bshell
should be able to handle this)
if (ret_val = 0) then
ret_val = ftp.quit(secondconnection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(secondconnection, response)
endif
if (ret_val = 0) then
| continue with first connection
ret_val = ftp.chdir("pub", connection)
endif
if (ret_val = 0) then
ret_val = ftp.mkdir("test", connection)
endif
| Check file.chmod for available mode flags
if (ret_val = 0) then
ret_val = ftp.chmod(S_IRWXU + S_IRWXG + S_IRWXO, "test",
connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
if (ret_val = 0) then
ret_val = ftp.put("${BSE}/tmp/afile", "ftp.bc", FTP_BINARY,
connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
| retrieves dir/nlst from remote site and write output to file
(first argument)
| note that current dir may be differ from user to user.
if (ret_val = 0) then
ret_val = ftp.nlst("dir.nlst", ".", connection)
endif
if (ret_val = 0) then
ret_val = ftp.dir("dir.dir", ".", connection)
endif
| when transferred from windows to unix, and now getting it in
ascii mode, you will get a cr/lf translated file
if (ret_val = 0) then
ret_val = ftp.get("${BSE}/tmp/afile.ftped", "afile",
FTP_ASCII, connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
if (ret_val = 0) then
ret_val = ftp.rename("afile", "afile.renamed", connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
if (ret_val = 0) then
ret_val = ftp.del("afile.renamed", connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
if (ret_val = 0) then
ret_val = ftp.rmdir("test", connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
| errorneous call
if (ret_val = 0) then
ret_val = ftp.rmdir("notexistingdir", connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
if (ret_val = 0) then
ret_val = ftp.chdir("..", connection)
endif
if (ret_val = 0) then
ret_val = ftp.last.response(connection, response)
endif
| after quit, you need to setup a new connection.
if (ret_val = 0) then
ret_val = ftp.quit(connection)
endif
}
mark_h
19th May 2010, 16:37
Cool - just had this thread pointed out to me. Needless to say the example posted by Ralph worked on my 4c4 system. Now I need to go see if the wiki has any help on these commands - could not find anything on my system.
ashu2814
15th September 2015, 08:07
Hi,
I am able to transfer the file by using your code . The file is getting transferred but with 0 bytes.
What can be the possible error?
Regards,
Ashutosh
bhushanchanda
15th September 2015, 08:48
Hi,
It might be the permissions issue. Check the source file name permission.
ashu2814
16th September 2015, 10:06
Hi,
I can do it manually with same permissions.
Is there some problem in my code?
ret_val = ftp.put("sourcepth/aa.txt",
"targetpath/aa_1.txt", FTP_BINARY, remote.connection)
kruyoupatel
11th May 2016, 14:31
Hello Guys,
The FTP functions mentioned above all worked for me for single file knowing filename.
But, is there other functions to fetch one by one file from a directory.
Like there is "dir.entry" for Baan server directory.
This function fetches the filenames and the return value with the help of which we can loop in directory.
Also please mention where did you find this functions(including above all), because I did checked Programmers Guide 6.1 ver 7.6.0 but did not find any functions in it.
adapalak
12th October 2016, 16:17
Hi
I am using FP7 i want to transfer the file to an sftp location which has password and user name.
How to transfer it
In the baan board i had seen function like ftp.connect etc
to use this what macros or #inclides<> do i need to use
any other way to transfer the files
Thanks and Regards,
Karthik
mark_h
12th October 2016, 16:57
No specific includes I am aware of - the one time I tested it I only see ottdllbw. For connecting see the ftp.login statement by ralph. Another way to do this is to write a OS script to do the FTP and then just execute the script.
bhushanchanda
12th October 2016, 17:37
The FTP functions are depreciated and also, they used to support FTP protocol only AFAIK.
As Mark already suggested, you can build a utility on your own using a bat file + winscp combination which will do the task.
Here is a link (http://www.itworld.com/article/2928599/windows/how-to-automate-sftp-file-transfers-in-microsoft-windows.html) which might get you going.
günther
13th October 2016, 08:37
Hi friends.
I agree that it's cool to have such functions even on Baan IV. BUT: In our company it's strictly forbidden to use ftp for new development, because this protocol is damned old, unsave, transfers Passwords and data in plain text and so on. We have to use sftp instead.
Regards
Günther
mark_h
13th October 2016, 14:49
Agreed Gunther. We have to use sftp also.