Hi I'm using Rebex.Net.Ftp 2.0.2567, and I want to check the Ftp connection state at the end of my try/catch block in order to disconnect if there was some error during transfer etc. I thought something like this might work :

Finally

    If ftp.GetConnectionState.Connected Then
        UpdateStatus("Disconnecting")
        ftp.Disconnect()
    End If

End Try

However, I get a InvalidOperationException error telling me that I'm "Not connected to the server".

Can anyone suggest where I'm going wrong please ?

Thanks, Martin

asked 26 Jan '10, 15:58

Martin%20House's gravatar image

Martin House
896
accept rate: 100%


This is caused by a bug in the Ftp object's GetConnectionState method that was fixed in Rebex FTP 2.3.2666: GetConnectionState no longer fails on disconnected objects. Sorry for inconvenience!

Workaround for 2.0.2567:

   Finally

       If ftp.State <> FtpState.Disconnected _
          AndAlso ftp.GetConnectionState.Connected Then
            UpdateStatus("Disconnecting")
            ftp.Disconnect()
       End If

   End Try
link

answered 26 Jan '10, 17:32

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.4k28
accept rate: 31%

Thanks ! I'll try the workaround

(26 Jan '10, 17:50) Martin House
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×152
×3

Asked: 26 Jan '10, 15:58

Seen: 1,905 times

Last updated: 09 Feb '10, 18:50