I have a script that uses FTP to send files to a site which we open by IP address. We've been asked to change to SFTP (port 22) and use the Domain Name Service name instead of an IP address. Does the 3000 support using DNS names?
Allego's Donna Hofmeister replies:
If you are going to use DNS, you must have your 3000 configured for that. It's easily done.
However, if you've never done anything on your 3000 make it act like a real computer (oh -- that's right, it is a real computer and fully capable of using DNS), this can turn into a can o' worms.
For 'DNS lite' it's probably simplest to:
1. Copy hostsamp. net to hosts.net
2. Edit hosts.net to make sure it has
220.127.116.11 name <--- where 18.104.22.168 and name are corrected to the system you want to connect to
4. Edit nsswitch.net to have this line:
hosts : files[SUCCESS=return NOTFOUND=continue]
With this done, the 3000 sorta kinda acts like it's using DNS — because it's looking the the hosts file for how to translate 'name' into '22.214.171.124'
Tony Summers provides a caveat:
One warning. The upgrade from FTP to sFTP (or SSH FTP etc) can involve more change to your scripts than you expect. What we do for FTP (originally on the HP 3000, and now on the HP-UX server) is build a text file with the commands (the sample below, edited)
user USERNAME PASSWORD
get /export/002_iccm_extract_1161.csv ICR21161
The file is then presented to the FTP client. On the HP 3000 it was something like....
RUN FTP.ARPA.SYS < FTPT0070 > FTPS0070
Then both the output file, FTPS0070, and any JCWs set by the FTP program were inspected to test the success of the FTP session.
Connected to xxxxxx.co.uk
220 Welcome to FTP service - xxxx.
331 Please specify the password.
230 Login successful.
200 Switching to ASCII mode.
200 PORT command successful. Consider using PASV. 550 Failed to open file.
In particular, the 3-digit status codes were analysed, looking for error codes like "550".If you do something similar in your FTP scripts, then all I can say is welcome to a very different world.
Karsten Brøndum adds:
Here's a completely different approach.
Depending on your skills in the Java area, there is a nice LPGL package called ftp4j (which requires Java 1.4 or later) that I have used a couple of times. It's a full-featured Java-based FTP client. (By the way, ftp4j will do both SFTP and FTPS). I've found it way easier than to fiddle with files with text files containing commands, especially when it comes to error handling.