I have a VB.NET application that does an FTP and redirects the Standard Output to a file. I only get partial data from the StandardOutput. The missing contents are the actual FTP replies (like "150 Open...." and "226 Transfer.....").
I've scoured this site and the internet, and have seen several others ask this similar question but none have any answers.
All is well is most situations, except of course in the one environment where the code will run in Production! I perform this FTP Routine two times in my code, sending output files to two different mainframe IPs. In my Dev environment (which happens to be XP), all is hunky-dorey for both routines; I get my desired reply codes. In my Test environment (which happens to be 2003), all is hunkey-dorey for one routine - the other in-house mainframe box does not produce the reply codes in the piped output log. However, when I do an FTP from the command prompt (in both Dev and Test environs), the Reply Codes are indeed there.
What's the .NET mystery? I suspect it's .NET and not the mainframe since all other combos work just fine.
Here's a code snippet:
Dim FixedLiteral As String = FileParam4
Dim DOS As New Process
Dim pinfo As New ProcessStartInfo("ftp.exe
pinfo.Arguments = "-n -d -s:"
pinfo.Arguments += FixedLiteral
ut = True ' set to "true" to enable logging
r = False
pinfo.UseShellExecute = False ' set to true to make silent/background
' Execute the process
DOS = Process.Start(pinfo)
If DOS.Start() Then
' Create the file for storing the output of the process
Dim outfile As New System.IO.StreamWriter(Fil
' Make sure the process has completed
' Dump all the output from the process into the file
adToEnd) 'original line and location
'After the FTP process is done, I must open up the log file and check for the string "226 File received ok". If I don't find it, then I will have to try the FTP again.
mySRftp = New StreamReader(FileParam5)
mySRText = mySRftp.ReadToEnd()
If InStr(mySRText, "226 Transfer completed") > 0 Then
'Remove the concatenated ftp'ed file.
BadAttemptCnt += 1
If BadAttemptCnt < 4 Then
This is the Output that is produced in DEV, that I want to see on the TEST box:
ftp> Connected to 162.xxx.xxx.x.
220 Upstanding Systems FTP Server version 70.144.48 ready.
ftp> ---> user XXXXXX
331 User name is okay; need password.
230 User logged in, proceed.
200 Representation Type is ASCII Non-print.
ftp> ---> quote SITE RECL 770
SITE RECL 770
200 recordLen is 770 Characters.
ftp> ---> put C:\inetpub\wwwroot\Joseph\
200 PORT command successful.
---> STOR 00000552
150 Opening data connection for 00000552 (162.xxx.xxx.xxx,3483).
226 Transfer completed to 00000552 ON PROGRAMMING.
ftp: 4632 bytes sent in 0.00Seconds 4632000.00Kbytes/sec.
ftp> ---> quit
This is the problematic output that I see on the TEST box:
---> open 162.xxx.xxx.x
---> quote SITE RECL 770
SITE RECL 770
---> put D:\Inetpub\wwwroot\Joseph\
---> STOR 00000554