Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
8.6k views
in .NET FTP by (480 points)
Hi guys,

I have a problem that my program crashes with the exception, Arguments too long. What does this mean? i've checked the code and everything seems fine as I can download other things in my code. But one function appears to be crashing. I dont understand what its telling me?

11 Answers

0 votes
by (162k points)
Can you post the stack trace and a log file if possible?
0 votes
by (480 points)
I test my program at work you see and do all my programming at home. When i test my program at ome everythings fine! When you mean the Log File where is this kept. Is the stack trace the meesage box from the edt dll when you get an unhandled exception? If so i'll get a screen dump and post it.
THanks..
0 votes
by (162k points)
A screen dump will help a lot. For logging, have a quick search on these forums for how to switch logging on.
0 votes
by (480 points)
Cant find where to switch logging on but here is the text that appears in the Error messagebox when the program crashes, it appears to be crashing when I either request the
number of files in the directory of asking for the length of the array i put the files to. Not sure if this is any help:-


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
EnterpriseDT.Net.Ftp.FTPException: Arguments too long (code=550)
at EnterpriseDT.Net.Ftp.FTPClient.Dir(String dirname, Boolean full)
at EnterpriseDT.Net.Ftp.FTPConnection.GetFiles(String directory)
at EnterpriseDT.Net.Ftp.FTPConnection.GetFiles()
at WindowsApplication2.PmcForm.GetRtMac()
at WindowsApplication2.PmcForm.button4_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
WindowsApplication2
Assembly Version: 1.0.2766.39906
Win32 Version: 1.0.2766.39906
CodeBase: file:///C:/Documents%20and%20Settings/csmalls/Desktop/Release/WindowsApplication2.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
edtFTPnet
Assembly Version: 1.2.4.0
Win32 Version: 1.2.4.0
CodeBase: file:///C:/Documents%20and%20Settings/csmalls/Desktop/Release/edtFTPnet.DLL
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
0 votes
by (162k points)
A string being sent to the FTP server is too long for it, and it is complaining. Without logging it is a bit hard to tell exactly what caused it.

Try

Logger.LogLevel = LogLevel.Debug;
Logger.LogFile = "mylogfile.log";
0 votes
by (480 points)
This code does not work. I've put this directive at the top "using EnterpriseDT.Util.Debug;" Is this correct?


I get the following error.
'EnterpriseDT.Util.Debug.Logger' does not contain a definition for 'LogLevel'

PMC.cs(538): 'EnterpriseDT.Util.Debug.Logger' does not contain a definition for 'LogFile'
0 votes
by (162k points)
doh, of course that should be FTPConnection.LogLevel and FTPConnection.LogFile
0 votes
by (480 points)
Ok thanks for that! I've tried it and this is the logfile that I get from it. Hope you can gleam some reasons for the crash: -

DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.763 : ---> USER ******
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.763 : 331 Password required for freeze.
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.763 : ---> PASS ********
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.779 : 230 User ****** logged in.
DEBUG [FTPConnection] 9 Aug 2007 09:10:02.779 : Successfully logged in
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.779 : ---> TYPE I
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.779 : 200 Type set to I.
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.779 : ---> PWD
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.779 : 257 "/usr1/freeze" is current directory.
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.810 : ---> CWD /u/freeze/uk/
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.810 : 250 CWD command successful.
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.810 : ---> PWD
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : 257 "/u/freeze/uk" is current directory.
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : ---> PASV
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : 227 Entering Passive Mode (20,9,111,9,126,253)
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : Server supplied address=20.9.111.9
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : Server supplied port=32509
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : Substituting server supplied IP (20.9.111.9) with remote host IP (20.9.111.9)
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : NewPassiveDataSocket(20.9.111.9,32509)
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : ---> NLST .
DEBUG [FTPControlSocket] 9 Aug 2007 09:10:02.826 : 550 Arguments too long


My code is this (dont laught if it's poor i'm still learning) :-
public void GetRtMac()
{
  int iCount =0;         
  bool FileOK = false;
         
  ftp.ChangeWorkingDirectory("/u/freeze/uk/");
  ftp.TransferType = FTPTransferType.BINARY;

  string[]temp = ftp.GetFiles(); // THIS SEEMS TO CAUSE PROLEMS

  int iMaxSize = temp.GetLength(0);

  for(iCount = 0;iCount < iMaxSize;iCount++)
  {
    FileOK = temp[iCount].EndsWith(".rt");
    if(FileOK)
    {
      m_sCurrentFile = temp[iCount].ToString();
      ftp.DownloadFile("c:\\chris\\" + m_sCurrentFile, m_sCurrentFile);
      FileOK = false;
    }
  }
}
0 votes
by (51.6k points)
It looks like this particular FTP server doesn't like to have an argument following the NLST command. This command is sent by FTPConnection when you call GetFiles(). Please try using GetFileInfos() instead as this calls a different FTP commands (i.e. LIST). Hopefully the server will accept an argument after that command. GetFileInfos() returns the file listing as an array of FTPFile objects. You can use FTPFile.Name to obtain the name of the file.

- Hans (EnterpriseDT)
0 votes
by (480 points)
OK I will try. The problem I've got though is that this GetFiles seems to work for every other function that i use it with. For example I use the following code for another section of downloads :-


public void GetBinFiles()
{
int iCount =0;
bool FileOK = false;

ftp.ChangeWorkingDirectory("/u/freeze/polaris/");
string[]temp = ftp.GetFiles();
int iMaxSize = temp.GetLength(0);
for(iCount = 0;iCount < iMaxSize;iCount++)
{
FileOK = temp[iCount].EndsWith(".BIN");
if(FileOK)
{
m_sCurrentFile = temp[iCount].ToString();
FileOK = false;
DownloadFile(m_sCurrentFile);
}
}
}


This code is identical except for the directory I change into and this works perfectly! How come the other code doesn't?? Is there anyway to stop this NTLST command. Is it necessary??

I'll try the other way though.

THanks very much

Categories

...