DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   VB.NET (http://www.daniweb.com/forums/forum58.html)
-   -   FTP error (http://www.daniweb.com/forums/thread31218.html)

mordtechin Aug 26th, 2005 12:35 pm
FTP error
 
Hello all you VB.NET 'ers

This being my first post would first of all like to say "Hallo!" :cheesy:

My problem is with Microsoft's FTP class
http://support.microsoft.com/default...b;en-us;832679

When I use this class, I am calling the
GetFileList Function to populate a listbox so that the user may be able to choose the files to download. However, it does not consistently return all the files. Usually it either 1] return only 1 file in the directory (if lots of files are in directory only returns one) 2] return all files in directory.

Has anyone had the same problem before and know how to fix this or have another FTP class that I could use to achieve this?

Thanks in advance.This should help greatly in several of the programs I need to run that need to retrieve a file from an FTP site to process and such.

mordtechin Aug 26th, 2005 1:36 pm
Re: FTP error
 
Actually I "solved" it.

In the GetFileList Function is the following code
        Do While (True)
          m_aBuffer.Clear(m_aBuffer, 0, m_aBuffer.Length)
          bytes = cSocket.Receive(m_aBuffer, m_aBuffer.Length, 0)
          m_sMes += ASCII.GetString(m_aBuffer, 0, bytes)
              If (bytes < m_aBuffer.Length) Then
                  Exit Do
              End If
        Loop
I replaces it with the following which seems to work 100% now.

        Do
            m_aBuffer.Clear(m_aBuffer, 0, m_aBuffer.Length)
            bytes = cSocket.Receive(m_aBuffer)
            If bytes > 0 Then
                m_sMes += ASCII.GetString(m_aBuffer, 0, bytes)
            End If
        Loop Until bytes = 0
This snipped of code which I edited can be obtained from
http://www.mentalis.org/classlib/class.php?id=23


:-)


All times are GMT -4. The time now is 9:51 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC