[Simh] FTP client connecting to SIMH/OpenVMS?

Peter Moreton petermoreton at hotmail.co.uk
Thu Jun 12 03:45:28 EDT 2008


Thanks Martin, I wanted to avoid 'rolling my own' as you have done. And also, I'm lazy,.... with the edtftp class I can do simple stuff like:
 
                // FTP 'put' this file to the backend                ftpConnection1.UploadFile(Resources.LocalFolder + "/" + name, name);
                // Rename the .GET to be .FET                ftpConnection1.RenameFile(name, name.Replace(".GET", ".FET"));
I have never been a fan of object orientation, but when C# and it's classes certain make me think again....
 



> Subject: Re: [Simh] FTP client connecting to SIMH/OpenVMS?> Date: Thu, 12 Jun 2008 08:52:57 +0200> From: MV at PDV-SYSTEME.DE> To: simh at trailing-edge.com> CC: petermoreton at hotmail.co.uk> > Peter,> > > I'm struggling to get a simple client program running > > on a PC to be able to FTP a file to/from OpenVMS 7.1 running > > under SIMH. The issue is simple: the Microsoft .NET 2.0 FTP > > class fesses-up when confronted with VMS directory names. It > > basically doesn't work, and Microsoft have acknowledged this > > as an issue.> > > > I'm just wondering if anyone else on the list has solved this > > problem, of how to write a simple Windows program to get > > files in/out of VMS, using c# / DotNet etc.> > No idea what the "Microsoft .NET 2.0 FTP class" looks like, but> here's something I wrote that uses the WinInet FTP functions> to get all files in a directory (beware of lines wrapping).> > HTH,> Martin> > > /*> Format of FtpFindFirstFile/InternetFindNextFile is the same as an FTP DIR, that is:> > Ftp> dir sys$manager:decw*.com> > Directory SYS$SYSROOT:[SYSMGR]> > DECW$KILLSERVER0.COM;1 No privilege for attempted operation> DECW$PRIVATE_APPS_SETUP.COM;2 No privilege for attempted operation> DECW$PRIVATE_APPS_SETUP.COM;1 No privilege for attempted operation> > Total of 3 files, 0/0 blocks> > Directory SYS$COMMON:[SYSMGR]> > DECW$CONSOLE.COM;1 3/3 29-MAR-2000 07:32:20 [FIELD,SYSTEM] (RWED,RWED,RE,RE)> DECW$DEFAULT_DESKTOP.COM;1> 1/3 29-JAN-2004 15:50:06 [FIELD,SYSTEM] (RWED,RWED,RE,RE)> DECW$DEVICE.COM;1 56/57 1-OCT-2003 22:04:23 [FIELD,SYSTEM] (RWED,RWED,RE,RE)> DECW$DEVICE_CONFIG_COMMON.COM;1> 6/6 5-JAN-1994 13:08:13 [FIELD,SYSTEM] (RWED,RWED,RE,RE)> ...> > Total of 30 files, 384/420 blocks> > Grand total of 2 directories, 33 files, 384/420 blocks> > Ftp>> > > except that blank lines are skipped.> > */> int GetFiles(HINTERNET hConnection, LPSTR pattern) {> HINTERNET hFindFile = NULL;> WIN32_FIND_DATA FindFileData;> int rc = ERROR_SUCCESS;> char fspec[_MAX_PATH],> lastspec[_MAX_PATH] = "",> *p;> BOOL continuation_line = FALSE;> > hFindFile = FtpFindFirstFile(hConnection, "*.*", &FindFileData, INTERNET_FLAG_RELOAD, 0);> if (! hFindFile)> return(ProcessError("FindFirstFile"));> > do {> if (verbosity > 2)> fprintf(stderr, " %s\n", FindFileData.cFileName);> if (continuation_line) {> continuation_line = FALSE;> continue;> }> strcpy(fspec, FindFileData.cFileName);> /*> if (fspec[0] == ' ') // continuation line> continue;> */> if (strncmp(fspec, "Directory ", sizeof("Directory ")) == 0) // directory line> continue;> if (strncmp(fspec, "Total of ", sizeof("Total of ")) == 0) // statistics line> continue;> if (strncmp(fspec, "Grand total of ", sizeof("Grand total of ")) == 0) // statistics line> continue;> if (strchr(fspec, ' ') == NULL) // no complete entry> continuation_line = TRUE;> _strupr(fspec);> if ((p = strchr(fspec,';')) != NULL) // strip semicolon and everything after it> *p = '\0';> if (strcmp(fspec, lastspec) == 0) // multiple versions of the same file> continue;> strcpy(lastspec, fspec);> if (strcmp(&fspec[strlen(fspec)-4], ".DIR") == 0) // sub-directory entry> continue;> if (! match(pattern, fspec)) // no match?> continue;> > if (verbosity > 0)> fprintf(stderr, "GETting file %s\n", fspec);> > if (!(opt & OPT_M_NOCOPY) && ! FtpGetFile(> hConnection, // connection handle> fspec, // remote file> fspec, // local file name> FALSE, // fail if exists?> FILE_ATTRIBUTE_NORMAL, // CreateFile() flags> FTP_TRANSFER_TYPE_ASCII // flags> | INTERNET_FLAG_RELOAD,> 0 // context> )) {> rc = ProcessError("FtpGetFile");> break;> }> strcat(fspec, ";"); // UCX FTP DEL needs a semicolon> if (!(opt & OPT_M_NODELETE) && ! FtpDeleteFile(hConnection, fspec)) {> rc = ProcessError("FtpDeleteFile");> break;> }> }> while (InternetFindNextFile(hFindFile, &FindFileData));> > if (rc == ERROR_SUCCESS && GetLastError() != ERROR_NO_MORE_FILES)> ProcessError("InternetFindNextFile");> > InternetCloseHandle(hFindFile);> > return(rc);> }> > -- > O Lord, won't you buy me | Martin Vorlaender | OpenVMS rules!> an HP OS | work: mv at pdv-systeme.de> its name starts with "Open" | http://vms.pdv-systeme.de/users/martinv/> and ends in "VMS" ... | home: martin.vorlaender at t-online.de 
_________________________________________________________________
Great deals on almost anything at eBay.co.uk. Search, bid, find and win on eBay today!
http://clk.atdmt.com/UKM/go/msnnkmgl0010000004ukm/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20080612/a794d2e3/attachment-0002.html>


More information about the Simh mailing list