.NET Framework Bookmark and Share   
 index > Network Class Library (System.Net) > C# FTP Connection pooling using FTPWebResponse?
 

C# FTP Connection pooling using FTPWebResponse?

So I'm trying to simulate an mget using FtpWebRequest. It is pretty straightforward and working. Since wildcards are not supported for getting files, I do a directory, then parse out the file names, and iteratively do gets. All works fine.

Now for the quandry...

I don't want to establish a new FTP session for each file, but that is what the GetResponse does. I was hoping to create one FTP session, and do iterative gets, then close the session. It seems like the object I have to build to do a single get that has credentials and all, will ONLY establish an FTP session, get one file, and close it. I don't see a (easy?) way to open a connection and reuse it using the FtpWebRequest, and if I were to do what i want, I'd have ot start messing with lower level socket programming to pool the connection and reuse it.

Help? Or just confirm that I have to do it the way I have been unless I want to do socket programming?

Thanks in advance.

Dave
  • Moved bynobugzMVPWednesday, August 26, 2009 4:57 PM (From:.NET Base Class Library)
  •  
certdave
Have you tried setting KeepAlive=true? (http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.keepalive.aspx )

Note, that even if you set KeepAlive=true, it only applies to the control connection, not the data connection.

I dont remember offhand, if the Ftp protocol allows you to keep the data connection alive after the data transfer is complete.

feroze
--
http://ferozedaud.blogspot.com
http://blogs.msdn.com/feroze_daud
Feroze Daud
Have you tried setting KeepAlive=true? (http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.keepalive.aspx )

Note, that even if you set KeepAlive=true, it only applies to the control connection, not the data connection.

I dont remember offhand, if the Ftp protocol allows you to keep the data connection alive after the data transfer is complete.

feroze
--
http://ferozedaud.blogspot.com
http://blogs.msdn.com/feroze_daud
Feroze Daud

You can use google to search for other answers

Custom Search

More Threads

• Network monitoring s/w
• how we make chat application in vb.net 2005
• The Amazingly Forgotten 2-Way .net Rijndael CryptoStream
• getting access to wininet (httponly) cookies: to share with HttpWebRequest
• Problem Reading cookie in windows form
• check facebook user online status (C#)?
• HTTP authentication
• ftpwebrequest/ftpwebresponse :The underlying connection was closed: An unexpected error occurred on a receive and the remote name could not be resolved
• Post HTTP Headers to log into forums
• Send a multipart post with data to upload put in a parameter called upfile