Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
9.6k views
in .NET FTP by (480 points)
Dear Sir,

I used "edtFTPnet.dll" to creat one program, I can download file from as400. I get one problem, I need set "QUOTE TYPE C 950" to AS400 ftp server.
How to send this subcommand to AS400 FTP server?
Thank you!!

11 Answers

0 votes
by (480 points)
I found a way, but I don't know it is good or not!!
VB Code:
Try
Try
FtpConnection1.InvokeFTPCommand("type c 950")
Catch ex As Exception
ListBox1.Items.Add("Err: " & ex.Message)
End Try

FtpConnection1.UploadFile(TextBox4.Text & TextBox5.Text, TextBox5.Text)

Try
FtpConnection1.InvokeFTPCommand("type a")
Catch ex As Exception
ListBox1.Items.Add("Err: " & ex.Message)
End Try

Catch ex As Exception
ListBox1.Items.Add("Err: " & ex.Message)
End Try
0 votes
by (162k points)
Sorry for not replying earlier - but this is exactly how it should be done.
0 votes
by (480 points)
Dear Support,

FtpConnection1.InvokeFTPCommand("type c 950") the command, some times working, some times isn't working. Can you found the problem?
0 votes
by (162k points)
What does the log show when it doesn't work?
0 votes
by (480 points)
When I download, the Chinese was wrong. in AS400 was correct.
I used windows command "FTP" to get this file was correct in my PC

LOG file::
DEBUG [FTPConnection] 3 三月 2007 10:23:04.197 : Set LocalDirectory='C:\TEMP\'
DEBUG [HostNameResolver] 3 三月 2007 10:23:04.347 : 192.168.64.111 resolved to 192.168.64.111
DEBUG [FTPClient] 3 三月 2007 10:23:04.347 : Connecting to 192.168.64.111:21
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.597 : 220-QTCP at S654243B.id-logistics.com.tw.
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.607 : 220 Connection will close if idle more than 5 minutes.
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.627 : ---> USER milo
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.627 : 331 Enter password.
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.627 : ---> PASS ********
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.677 : 230 MILO logged on.
DEBUG [FTPConnection] 3 三月 2007 10:23:04.677 : Successfully logged in
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.687 : ---> TYPE A
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.687 : 200 Representation type is ASCII nonprint.
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.687 : ---> PWD
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.698 : 257 "APXOMENU" is current library.
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.708 : ---> SYST
DEBUG [FTPControlSocket] 3 三月 2007 10:23:04.708 : 215 OS/400 is the remote operating system. The TCP/IP version is "V5R2M0".
DEBUG [FTPControlSocket] 3 三月 2007 10:23:14.211 : ---> CWD edi01in
DEBUG [FTPControlSocket] 3 三月 2007 10:23:14.231 : 250 "EDI01IN" is current library.
DEBUG [FTPControlSocket] 3 三月 2007 10:23:14.231 : ---> PWD
DEBUG [FTPControlSocket] 3 三月 2007 10:23:14.241 : 257 "EDI01IN" is current library.
DEBUG [FTPControlSocket] 3 三月 2007 10:23:17.095 : ---> PASV
DEBUG [FTPControlSocket] 3 三月 2007 10:23:17.246 : 227 Entering Passive Mode (192,168,64,111,15,173).
DEBUG [FTPControlSocket] 3 三月 2007 10:23:17.246 : Server supplied address=192.168.64.111
DEBUG [FTPControlSocket] 3 三月 2007 10:23:17.246 : Server supplied port=4013
DEBUG [FTPControlSocket] 3 三月 2007 10:23:17.246 : Substituting server supplied IP (192.168.64.111) with remote host IP (192.168.64.111)
DEBUG [FTPControlSocket] 3 三月 2007 10:23:17.246 : NewPassiveDataSocket(192.168.64.111,4013)
DEBUG [FTPControlSocket] 3 三月 2007 10:23:17.246 : ---> NLST EDI01IN
DEBUG [FTPControlSocket] 3 三月 2007 10:23:24.826 : 125 List started.
DEBUG [FTPClient] 3 三月 2007 10:23:24.826 : -->DD07022229.DD07022229
DEBUG [FTPClient] 3 三月 2007 10:23:25.097 : -->DESADV01
DEBUG [FTPClient] 3 三月 2007 10:23:25.097 : -->HM070301ZK.HM070301ZK
DEBUG [FTPClient] 3 三月 2007 10:23:33.669 : -->PT0703025V.PT0703025V
DEBUG [FTPClient] 3 三月 2007 10:23:33.669 : -->ZDCBAT.ZDCBAT
DEBUG [FTPClient] 3 三月 2007 10:23:33.669 : -->ZFTM49.ZFTM49
DEBUG [FTPClient] 3 三月 2007 10:23:33.669 : -->ZHANMOV.ZHANMOV
DEBUG [FTPClient] 3 三月 2007 10:23:33.669 : -->ZORDER.ZORDER
DEBUG [FTPClient] 3 三月 2007 10:23:33.669 : -->ZPARTIN.ZPARTIN
DEBUG [FTPClient] 3 三月 2007 10:23:33.669 : -->ZPRICAT.ZPRICAT
DEBUG [FTPControlSocket] 3 三月 2007 10:23:33.719 : 250 List completed.
DEBUG [FTPClient] 3 三月 2007 10:23:33.719 : Found 455 listing lines
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.051 : ---> type c 950
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.061 : 200 Representation type is CCSID 950.
DEBUG [FTPConnection] 3 三月 2007 10:25:12.251 : Combining absolute path 'C:\TEMP\' with relative path 'C:\TEMP\PT0703025v.PT0703025v'
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.261 : ---> PASV
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.291 : 227 Entering Passive Mode (192,168,64,111,210,36).
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.291 : Server supplied address=192.168.64.111
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.291 : Server supplied port=53796
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.291 : Substituting server supplied IP (192.168.64.111) with remote host IP (192.168.64.111)
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.291 : NewPassiveDataSocket(192.168.64.111,53796)
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.291 : ---> RETR PT0703025v.PT0703025v
DEBUG [FTPControlSocket] 3 三月 2007 10:25:12.551 : 150 Retrieving member PT0703025V in file PT0703025V in library EDI01IN.
DEBUG [FTPControlSocket] 3 三月 2007 10:25:13.483 : 250 File transfer completed successfully.
DEBUG [FTPControlSocket] 3 三月 2007 10:25:13.483 : ---> type a
DEBUG [FTPControlSocket] 3 三月 2007 10:25:13.503 : 200 Representation type is ASCII nonprint.
DEBUG [FTPControlSocket] 3 三月 2007 10:25:41.253 : ---> QUIT
DEBUG [FTPControlSocket] 3 三月 2007 10:25:41.253 : 221 QUIT subcommand received.
0 votes
by (162k points)
Is there a character encoding problem?
0 votes
by (480 points)
I think Yes.
0 votes
by (480 points)
EnterpriseDT.Net.Ftp.FTPException 未處理
Message="Representation type is CCSID 950. (code=200)"
Source="edtFTPnet"
StackTrace:
於 EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
於 EnterpriseDT.Net.Ftp.FTPClient.Quote(String command, String[] validCodes)
於 EnterpriseDT.Net.Ftp.FTPConnection.InvokeFTPCommand(String command, String[] validCodes)
於 ftp_test.Form1.Button4_Click(Object sender, EventArgs e) 於 D:\TESTNET\ftp_test_Support Chinese\Form1.vb: 行 91
於 System.Windows.Forms.Control.OnClick(EventArgs e)
於 System.Windows.Forms.Button.OnClick(EventArgs e)
於 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
於 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
於 System.Windows.Forms.Control.WndProc(Message& m)
於 System.Windows.Forms.ButtonBase.WndProc(Message& m)
於 System.Windows.Forms.Button.WndProc(Message& m)
於 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
於 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
於 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
於 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
於 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
於 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
於 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
於 System.Windows.Forms.Application.Run(ApplicationContext context)
於 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
於 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
於 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
於 ftp_test.My.MyApplication.Main(String[] Args) 於 17d14f5c-a337-4978-8281-53493378c1071.vb: 行 81
於 System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
於 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
於 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
於 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
於 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
於 System.Threading.ThreadHelper.ThreadStart()
0 votes
by (480 points)
Working in QUOTE TYPE C 950
CODE VB:
        Try
            If ChkASC.Checked Then
                If CHKAS400.Checked Then
                    FtpConnection1.InvokeFTPCommand("type c 950", "200")
                Else
                    FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.ASCII
                End If
            Else
                FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.BINARY
            End If
            Dim myFileStream = System.IO.File.OpenRead(TextBox4.Text & TextBox5.Text)
            ListBox1.Items.Add("Upload Stream: " & TextBox5.Text)
            FtpConnection1.UploadStream(myFileStream, TextBox5.Text)
            FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.ASCII
        Catch ex As Exception
            ListBox1.Items.Add("Err: " & ex.Message)
        End Try
0 votes
by (480 points)
No Working in Quote type c 950
Code VB:
        If ChkASC.Checked Then
            FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.ASCII
            If CHKAS400.Checked Then
                FtpConnection1.InvokeFTPCommand("type c 950", "200")
            End If
        Else
            FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.BINARY
        End If

        ListBox1.Items.Add("Upload: " & TextBox5.Text)
       FtpConnection1.UploadFile(TextBox4.Text & TextBox5.Text, TextBox5.Text 
       FtpConnection1.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.ASCII

Categories

...