public static void Main(String[] args) { try { Curl.GlobalInit(CurlInitFlag.All); dnsLock = new Object(); cookieLock = new Object(); var urls = new[] { "http://www.codeplex.com", "http://www.yahoo.com", "http://www.cnn.com", "http://www.abc.com", "http://www.bbc.co.uk" }; using (var share = new CurlShare()) { share.LockFunction = OnLock; share.UnlockFunction = OnUnlock; share.Share = CurlLockData.Cookie; share.Share = CurlLockData.Dns; var workers = new List <Thread>(); foreach (var url in urls) { var et = new EasyThread(url, share); var thread = new Thread(et.ThreadFunc); workers.Add(thread); thread.Start(); } foreach (var thread in workers) { thread.Join(); } } Curl.GlobalCleanup(); } catch (Exception ex) { Console.WriteLine(ex); Console.ReadLine(); } }
public static void Main(String[] args) { try { Curl.GlobalInit(CurlInitFlag.All); dnsLock = new Object(); cookieLock = new Object(); var urls = new[] { "http://www.codeplex.com", "http://www.yahoo.com", "http://www.cnn.com", "http://www.abc.com", "http://www.bbc.co.uk" }; using (var share = new CurlShare()) { share.LockFunction = OnLock; share.UnlockFunction = OnUnlock; share.Share = CurlLockData.Cookie; share.Share = CurlLockData.Dns; var workers = new List<Thread>(); foreach (var url in urls) { var et = new EasyThread(url, share); var thread = new Thread(et.ThreadFunc); workers.Add(thread); thread.Start(); } foreach (var thread in workers) { thread.Join(); } } Curl.GlobalCleanup(); } catch (Exception ex) { Console.WriteLine(ex); } Console.ReadLine(); }