Login  
Search All Forums
Dart Home | PowerTCP FTP for .NET | Custom Development Reply | PowerTCP FTP for .NET Topics | Forums   
AuthorForum: PowerTCP FTP for .NET
Topic: Put Document - Not Intact
rmclean

From: BILLINGS, MT USA
Posts: 2
Member Since: 03/10/06
posted March 10, 2006 8:15 PM

Hi all, this is my first post, so let me know if I should put this elsewhere . . .

I am using the ftp (not ssl) in a vb.net app to ftp many files under various users to the same server. My results are a little strange, most of the files make it to the server okay, but some files are no longer valid (un-openable). It seems to occur in some of the snapshot files (but not all). Here is my code if it will help demonstrate what I am doing. First time trying this, I could be way off.

Protected WithEvents ftpSession As New Ftp()

. . .

Before passing user id , password, and list of files, I set the ftpSession to

.RawConnect("my ftp server", "21")

 . . .

With ftpSession

      .Username = a_strUserId
      .Password = a_strPassword

      strRemotePathParts = Split(a_strRemotePath, "\")

      For Each strRemotePathPart In strRemotePathParts
        Try
          .Invoke(FtpCommand.MakeDir, strRemotePathPart)
        Catch
‘ do nothing lazy way of making sure folder is there . . .
        Finally
          .Invoke(FtpCommand.ChangeDir, strRemotePathPart)
        End Try
      Next

      For Each strFilePath In a_objArrFiles
        
        objFile = New FileInfo(strFilePath)
        dblBeginSize = objFile.Length

        strFileName = objFile.
        
          .FileType = Dart.PowerTCP.Ftp.FileType.Image

          objFtpFile = .Put(strFilePath, strFileName)

        End If

        dblEndingSize = objFtpFile.Length

        If (dblEndingSize <> dblBeginSize) Then
          blnReturn = False
        End If

      Next

    End With

 . . .

After each list of files, I close the ftpsession with . . . you got it, .close()

Any ideas would be greatly appreciated.

Thank you and have a great weekend,
Ryan
rmclean

From: BILLINGS, MT USA
Posts: 2
Member Since: 03/10/06
posted March 10, 2006 8:58 PM

Hello again, I read some posts . . . moved the rawconnect and close/abort into the function that puts the file instead of the calling function. It made sense to only make one connection, since they are all to the same server, oh well. I also set the timeout parameter (60000).

It seems to work fine now.

Could any please let me know if I am doing this correctly?

Thanks, I appreciate your input.
Ryan
Raj

From: Rome, NY, USA
Posts: 389
Member Since: 02/01/06
posted March 13, 2006 12:38 PM

Hello Ryan,

The concept of making one connection to FTP server is logical, however I do not see it as the cause of the problems, that you were facing.

The Ftp component uses "auto-connect" functionality. In other words, there is no need for a connect or login call, because if any method is called and there is no connection, the component will automatically connect. So the RawConnect call is unnecessary. But there is no harm in using it.

You may try using Trace functionality to see what’s happening between your client and FTP Server. Thus you might get an explanation to the behavior that you were experiencing.

Let me know if you have further questions.

Regards,
Raj
Reply | PowerTCP FTP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX