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: Suggestions on dealing with errors during Put / Get
monty0018

From: oklahoma city, OK USA
Posts: 6
Member Since: 12/03/03
posted December 3, 2003 12:27 PM

How would you suggest dealing with a network error during a Put / Get? I have been testing Put'ing a file onto a server and in mid-put, unplugging my network cable. An exception is thrown but how would you suggest to properly catch this, handle it, and resubmit once connection is restored?
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted December 3, 2003 12:39 PM


Regarding catching handling:
You would put the call inside a try...catch ( like we do in our samples)

Regarding resubmitting:
If the server supports restart, you can restart the transfer where it left off. Otherwise you would have to start over from the beginning.

monty0018

From: oklahoma city, OK USA
Posts: 6
Member Since: 12/03/03
posted December 4, 2003 1:57 PM

The problem I am having with this is that when I unplug my lan connection, the server I am connected to is still holding a lock on the file, therfore, I am unable to do anything soon after this happens. It takes AT LEAST 15 minutes for the lock to release. I am thinking this is a Windows problem, not an FTP server issue or client-side issue. Any experience with similar issues?
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted December 4, 2003 6:44 PM

I haven't heard anything. Sorry.
monty0018

From: oklahoma city, OK USA
Posts: 6
Member Since: 12/03/03
posted December 5, 2003 8:44 AM

The basic code I'm using is below. Do you see anything I should be doing differently with my side of things?

 Private Sub btnPut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPut.Click
  Try
   'Ftp1.Restart = True
   Ftp1.BeginPut(txtLocal.Text, txtRemote.Text, Nothing)
   lbStatus.Items.Add("Transfer of " & txtLocal.Text & " has begun.")
  Catch ex As Exception
   MsgBox(ex.ToString)
  End Try

 End Sub
 Private Sub TransferDone(ByVal sender As System.Object, ByVal e As Dart.PowerTCP.Ftp.FileEventArgs) Handles Ftp1.EndPut
 
  If e.Exception Is Nothing Then
   Timer1.Stop()
   lbStatus.Items.Add("Successfully transferred file " & e.File.LocalFileName)
   lbStatus.Items.Add("File now on server as " & e.File.RemoteFileName)
   lbStatus.Items.Add(e.File.Count & " bytes transferred")
  Else
   lbStatus.Items.Add("Error: " & e.Exception.ToString)
   Ftp1.Close()
   lbStatus.Items.Add("Restarting transfer")
   Timer1.Start()
  End If
 End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  If Ftp1.Busy Then
   lbStatus.Items.Add("Socket is busy, not resending anything.")
  Else
   lbStatus.Items.Add("Socket is free, resending")
   btnPut_Click(Me, e)
  End If
 End Sub
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted December 5, 2003 9:46 AM

Nothing looks wrong there. If the server is locking the file, there isn't anything you can do about it at your end.

monty0018

From: oklahoma city, OK USA
Posts: 6
Member Since: 12/03/03
posted December 5, 2003 10:00 AM

That's what I figured. Thanks for all of your quick responses.
Reply | PowerTCP FTP for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX