C# - how to ftp multiple files on a single connection with FtpWebRequest object

hello all.
  i am having trouble trying to upload multiple files on a single connection with the ftpWebRequest object in C#.

basically i can get it to upload a single file, but when it comes back to the top of the loop and i try to say
Stream requestStream = myFTP.GetRequestStream()

i get an error saying:
   "Cannot re-call BeginGetRequestStream/BeginGetResponse while a previous call is still in progress."

and i already see that the previous upload ended with this response:
ClosingData - 226 Transfer OK


i wrap the requestStream declaration in a using statement as well as the .GetResponse() call
like this:
using (FtpWebResponse response = (FtpWebResponse)l_oFTP.GetResponse())
{
   //print out the status code and it says ClosingData - 226 Transfer OK
}

any ideas?

thanks in advance.
richardsimnettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JimBrandleyCommented:
Take a look at the response from Lushdog in this post:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=346122&SiteID=1

He claims that only a single connection is used.

Jim
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
reval1Commented:
It is because of you are using Stream requestStream, you need to use requestStream for every file and need to close it requestStream.Close() after every upload.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.