|
-
April 14th, 2011, 01:47 AM
#1
WebClient Async Upload for multiple servers
Hi All,
I'm trying to create an application that can upload the same file to multiple local servers at the same time.
I'm using this function to upload the file:
private void UploadFile(string _ip, string _file)
{
//Setup the client and Credentials
WebClient wc = new WebClient();
wc.Credentials = new NetworkCredential("user", "pass");
//set the Async routines
wc.UploadFileCompleted += new UploadFileCompletedEventHandler(UploadFileDone);
wc.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadProgress);
wc.UploadFileAsync(new Uri("http://" + _ip + DBPath), "POST", _file);
}
And When I Press the Start button, this routine runs the "UploadFile" Over each server in the list
private void btn_Start_Click(object sender, EventArgs e)
{
for (int i = 0; i < SiteList.Items.Count; i++)
{
UploadFile(SiteList.Items[i].Text, txtURL.Text);
}
}
The Problem is, I Can't seem to find a way to "link" between the routine "UploadProgress" & "UploadFileDone" for each site...
The ListView Is Like this:
IP Address | Upload Status
--------------------------
10.134.1.1 | Start...
10.134.1.2 | Uploading 23%
10.134.1.3 | Done.
10.134.1.4 | Uploading 71%
Thanks, for the assistant.
Liad
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
|