EldoS | Feel safer!

Software components for data protection, secure storage and transfer

CloseHandle and seeing files

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#3971
Posted: 10/08/2007 05:55:49
by  Richard Price
I have code in an application that has been working. But recently I could not see the files that are uploaded it has stopped working. I looked at the code and put 'try catch' exceptions around all code. When I ran it no error occursed. Then looking at the sample application I discovered that I had not used the closehandle method. I have now put this in. Would not using this method cause a maximum number of handles to be used and the files that are sent not to be listed? Is there anything else that might cause files that appear to be sent to not be visible on a SFTP server?

Lastly, is there anything that I can do to improve my code (pasted below) and written in VB.NET?

Try
Client.Open()
Catch ex As Exception
streamValidation.WriteLine("Error Opening Connection : " & ex.Message)
streamValidation.Close()
fsErrors.Close()
Client.Close(False)
Exit Sub
End Try

Try
Handle = Client.OpenDirectory("/report_upload")
Catch ex As Exception
streamValidation.WriteLine("Error Opening Directory : " & ex.Message)
streamValidation.Close()
fsErrors.Close()
Client.Close(False)
Exit Sub
End Try

Try
Client.UploadFile(localFile, "/report_upload/" & RemoteFile)
Catch ex As Exception
streamValidation.WriteLine("Error Uploading File : " & ex.Message)
streamValidation.Close()
fsErrors.Close()
Client.Close(False)
Exit Sub
End Try

streamValidation.Close()
fsErrors.Close()
Client.CloseHandle(Handle)
Client.Close(False)

End Sub

Thanks,
Richard.
#3972
Posted: 10/08/2007 06:29:54
by Eugene Mayevski (EldoS Corp.)

You don't need to open the directory before uploading the file. I think this might have caused the listing problem.


Sincerely yours
Eugene Mayevski

Reply

Statistics

Topic viewed 1494 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!