Geeks With Blogs
Works on my machine

From time to time people ask me to vote. They send me a link and say: "vote for my school", "vote for my recipe in a cooking contest", "vote on my child's drawing" etc. I'm sure it happens to you too. Personally, I don’t care, but it led me to an interesting thought – since it is possible to bypass IP restrictions through proxy gates, it should be also possible to make votes automatically. I only need to get a list of proxy servers. Luckily, I found a pretty big one under this link.


The goal

The goal was to create an application that performs as many asynchronous proxy connections as possible and keeps the UI responsive at the same time. Of course, the first part isn’t universal – it mainly depends on what the actual task does and what is the network bandwidth, but the point was to write an efficient app that doesn’t have bottlenecks.


Testing

After a couple of days of coding my app was ready. The only thing that was left was to pick a proper site to test it. Google told me to try pollcode.com. It was a perfect choice for me, because it imposes IP restriction, so that only one vote from one IP address can be made (per day/week/month/year – depending on the configuration). I created my own poll and here you can see the test result:



Implementation

Proxy Swarm is a WPF application that has been built in the spirit of MVVM architectural pattern. All HTTP connections are made by HttpClient class, which is available since .NET 4.5. Each connection is handled as a separate task and all these tasks run in a dedicated AppDomain.

The following external libraries were used:

  • Fody/PropertyChanged - injects INotifyPropertyChanged code into properties at compile time.
  • TPL Dataflow - provides dataflow components to help increase the robustness of concurrency-enabled applications. Here is a great introduction to Task-based Asynchronous Pattern, which also describes Dataflow library.

Download

Project website and source code: https://github.com/nabuk/ProxySwarm
Readme: https://github.com/nabuk/ProxySwarm#readme

If you have any questions, please feel free to leave a comment or drop me an email (you can find it on my GitHub profile).

Regards,
Jakub Niemyjski

Posted on Saturday, March 8, 2014 5:30 PM C# , asynchronicity , WPF | Back to top


Comments on this post: Proxy Swarm

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Jakub Niemyjski | Powered by: GeeksWithBlogs.net