FTP connection closing problem

  • Thread starter Thread starter B. Chernick
  • Start date Start date
B

B. Chernick

I've got a VB/Dot Net 2.0 Winforms app that connects to an FTP server and
uploads a file. I have very little experience writing FTP-related code.

In the simplest sense, once you've uploaded a file, what guarantees that an
FTP connection is completely closed?

I ask this because after I complete the upload and close all the objects
involved (the stream, the FTPWebResponse, the FTPWebRequest) I am unable to
list a different directory in the same FTP Server using unrelated code in a
different form. 'The Server returned an error: (550) File unavailable.'
 
I've got a VB/Dot Net 2.0 Winforms app that connects to an FTP server and
uploads a file.  I have very little experience writing FTP-related code..

In the simplest sense, once you've uploaded a file, what guarantees that an
FTP connection is completely closed?  

I ask this because after I complete the upload and close all the objects
involved (the stream, the FTPWebResponse, the FTPWebRequest) I am unable to
list a different directory in the same FTP Server using unrelated code ina
different form.  'The Server returned an error: (550) File unavailable.'

Look at Close method:
http://msdn.microsoft.com/en-us/library/system.net.ftpwebresponse.close.aspx

After you call Close method, if no exception occurs, it may mean that
the closing is successful.
And pay attention that this method is useful when KeepAlive property
is set to False.

And as you're describing you have closed it, isn't it normal not to
reach the already closed connection?...

HTH,

Onur Guzel
 
Back
Top