>I am writing a program in visual basic 4.0 and I would like to add an FTP call
>to our mainframe system to retrieve a file.
>Is anyone familiar with how I might do this in Visual Basic. I am using
>Microsoft TCP/IP stack (winsock.dll)
There are several books devoted to programming WinSock plus a number
of VBX and OCX to make life easier.
A quick and dirty approach: use VB to write a text file containing
the ftp commands you would use to retrieve the file, then use
ShellExecute to start the (32-bit console) FTP program that comes with
the MS stack using the text file as input.
>info...@londonhydro.com (Rob Moore) wrote:
>>I am writing a program in visual basic 4.0 and I would like to add an FTP call
>>to our mainframe system to retrieve a file.
>A quick and dirty approach: use VB to write a text file containing
>the ftp commands you would use to retrieve the file, then use
>ShellExecute to start the (32-bit console) FTP program that comes with
>the MS stack using the text file as input.
I would suggest this is an elegant or efficient approach, not a q&d one.
(Although I have used DevSoft's FTP control from VB32, and that is a very nice
way to go.)
To expand on McKittrick's suggestion:
(1) open a file and write an FTP script, call it anything (say, ftp.scr):
<userid>
<password>
cd <remote-dir>
lcd <local-dir>
ascii
get <remote.fileid>
(2) use VB's Shell to run ftp, e.g.:
I = Shell("cmd.exe /c ftp -i -s:ftp.scr host.name > ftp.log", 7)
Variations are numerous.
The FTP scripting on NT has improved in recent versions. You can now issue
local commands from the script. For example, I upload a file frequently, and
have to update a text file on that server to indicate the changes. The script
is something like:
<userid>
<password>
cd <remote-dir>
lcd <local-dir>
binary
hash
put <filename.exe>
ascii
lcd ..
get 00-index
!notepad <alocal-dir>\00-index
put 00-index
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+---
Christopher J. Sacksteder, c...@psu.edu
Center for Academic Computing, THE Pennsylvania State University
>On 4 Feb 1997 14:17:35 GMT, info...@londonhydro.com (Rob Moore) wrote:
>>I am writing a program in visual basic 4.0 and I would like to add an FTP call
>>to our mainframe system to retrieve a file.
>>
>>Is anyone familiar with how I might do this in Visual Basic. I am using
>>Microsoft TCP/IP stack (winsock.dll)
>Surely there are now ActiveX controls to do this sort of thing - I'd
>have a look at the ActiveX development area on www.microsoft.com and see
>what you can find. I imagine you can download the resdistributable parts
>of the ActiveX SDK at least.
>Zack
Zack,
Check this out:
http://www.packet.com/packet/garfinkel/96/47/index2a.html
Ian