[Practice] + use C # to implement multi-threaded file transmission over HTTP

Source: Internet
Author: User
Today, I saw an example about "multithreading", and I felt pretty good, so I started my work.

Source: http://dev.21tx.com/2006/07/05/11760.html

Because I didn't see any images before, I just practiced it step by step based on the text introduction. It is a little different. If you are interested, you can do it yourself.

Source code: Http://files.cnblogs.com/zzc315/httpftp_20070808.rar

My development environment is Microsoft Visual Studio 2005, which is different from the development environment of the author (visual studio.net 2002 development environment and Windows XP operating system:

Reference: http://msdn2.microsoft.com/zh-cn/library/ms171728 (vs.80). aspx # mtps_dropdownfiltertext

Solution:
// Form1.cs
Delegate void setlistboxcallback (string ListBox );
......
Public void setlistbox (string ListBox)
{
// Invokerequired required compares the thread ID of
// Calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
If (this. listbox1.invokerequired)
{
Setlistboxcallback d = new setlistboxcallback (setlistbox );
This. Invoke (D, new object [] {ListBox });
}
Else
{
This. listbox1.items. Add (ListBox );
}
}

// Httpfile. CS
// Formm. listbox1.items. Add ("Thread" + threadh. tostring () + "start receiving ");
Formm. setlistbox ("Thread" + threadh. tostring () + "start receiving ");

1. I recently read some basic knowledge about multithreading. I think this example is classic and interesting. I would like to share it with you;
2. If you have any suggestions or comments on learning "multithreading" or related materials, thank you for your consideration.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.