-
June 22nd, 2009, 03:18 AM
#1
FtpWebRequest doesn't work in parallel threads
I work with C# 2.0 VC2008.
I use a number of Background Workers for open multiply FTP Connections to same FTP Server. The connections are in an Active FTP Mode.
When I start 2 connections together, the first one is working properly and the second stops after the connection has been established good and waits for Data ( get data only after the first connection closed ).
When I run two applications with one FTP Session for each, I haven't any problem.
This is a part of request code :
Code:
// sPath = "ftp://user_name:user_pass@server_address:21//path")
FtpWebRequest request = (FtpWebRequest)WebRequest.Create( sPath );
request.UsePassive = false;
request.Proxy = null;
request.Method = WebRequestMethods.Ftp.GetFileSize;
this.curFTPState.FileName = Path.Combine(sPathTo, filename);
this.curFTPState.FTPMethod = WebRequestMethods.Ftp.GetFileSize;
this.curFTPState.Request = request;
// Start the asynchronous request.
IAsyncResult result = (IAsyncResult)request.BeginGetResponse(new AsyncCallback(RespCallback), curFTPState);
Elina
-
June 22nd, 2009, 01:46 PM
#2
Re: FtpWebRequest doesn't work in parallel threads
Does the FTP server in question allow multiple connections from the same IP?
www.monotorrent.com For all your .NET bittorrent needs
NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
-
June 23rd, 2009, 12:52 AM
#3
Re: FtpWebRequest doesn't work in parallel threads
Yes, actually same application, has run twice with one connection each, is connecting and getting data perfect. On specific server I can open only 2 connections simultaneously, because system limitation.
Elina
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|