Im writing an application that will use the HTTPSocket class in SystemNet. I have checked the msdn documentation regarding thread safety which infact is safe to deploy the class in a thread however im unable to reach a code point of execution where data is supposed to be displayed. Better yet let me copy paste some simple code for everyone to see. The results are dubious. class MyThreadPool { private static int i; private string web_response; private string company; private long thread_id; public MyThreadPool() { } public MyThreadPool(string business_string, long id) { this.company = business_string; this.thread_id = id; ThreadPool.QueueUserWorkItem(new WaitCallback(HackCorps), new AutoResetEvent(true)); } public void HackCorps(Object state) { string[] business = null; business = this.company.Split('^'); Stream business_stream = WebRequest.Create(business[0]).GetResponse().GetResponseStream(); StreamReader business_reader = new StreamReader(business_stream); Console.WriteLine(++i); } } and the main int main(){ string line = null; long i = 0; StreamReader read_business = new StreamReader("f://directory.txt"); while ((line = read_business.ReadLine()) != null) { MyThreadPool pool = new MyThreadPool(line, ++i); }return 0;<----Code get here since all thread classes are created although they aren't processed will cause the probram to terminate. Is there some sort of lock to prevent this? } Thanks for your help...
peterzorbas
Posts
-
Help ThreadPools/Threads -
javascript includeis there an equivelant to include external files in .js files similar to C/C++ #include? thanks.
-
Global ArraysOk the problem is because when I was debugging I added a watch for the array variables via the array var in the procedure, which would give it a out of context value when out of the proc. So lesson is when using globals to add watches on the global declaration not the var within a proc to ensure you have the value of the global representation.
-
Global ArraysI am writing a VBA macro in Excel, and have declared 2 global string arrays. I am manipulating these arrays in a couple of function without passing them as params -since they are global- however when I return from the first function my array is losing its elements. Is this code error, or am I missing something with arrays.
-
Google Earth MapsGOOGLE it. First try linking GEARTH COM object.
-
Where to learn how to layout components and pages?Well, the era of laying out with tables is almost gone. Google for tutorials on CSS, and DIV layouts.
-
classic ASP AJAXIs this supported. I know of ATLAS but i don't wish to use a dll. does ASP support it?
-
invalid cast exception helphey thanks. it worked
-
Question regarding 'if'use SelectedItem.ToString()
-
invalid cast exception helphi, i have a error that is not a real error. sometimes it works other times it throws an exception. im trying to cast a dataset from my cache and like i said sometimes it works sometimes it doesn't. is this a .net bug or something? if(!IsPostBack) Line 23: { Line 24: ds = (DataSet)Cache["cache_price"]; Line 25: if(ds == null) Line 26: { thanks
-
ASP and iFrameMaybe a Session
-
Asp.net directorieshow can i get this statement to execute System.IO.Directory.Create(Server.MapPath("DefaultWeb") + "/some_dir"); without compromising my security. thanks.
-
How to get the OutPut Parameter?if u use select statement then use a datareader. DataReader dr = sql.ExecuteReader() while(dr.read()) { msg = dr[0].ToString(); } dr[index] = the number of sequential columns in the sql statement so if u had select first, last, middle from table then it would be dr[0].ToString(), dr[1].ToString(), dr[2].ToString() or dr["first"].ToString(), dr["middle"].ToString(), dr["last"].ToString().
-
Delegatesi find delegates to be the same as function pointers in C/C++. so then we would be able to pass the address/delegate of some function as a parameter some_func(my_delegate); some_func(Delegate a) { a; //would call the function }
-
creating asp.net project on windows 2003 web serveranyone know how i can create a asp.net on remote windows web server edition? i seem to be doing the steps ok, however im not sure if configuration allows me to do so. can someone point me to an article or give some insight on how to do this. thanks
-
windows taskbarhi i am working on a full screen app, and was wondering if there is any way of hiding the taskbar.
-
help with this plscould someone help me with this please. How can i accept both a background and foreground color. Currently either 1 or the other is accepted and rendered. here is the code. from what i understand its an if statement that will do this. thanks in advance. //---------------------------------------------------------------- // Variable Initialization //---------------------------------------------------------------- var bgcolor=String(Request("bgcolor")); bgcolor = bgcolor == "undefined" ? "white" : bgcolor; var fgcolor=String(Request("fgcolor")); fgcolor = fgcolor == "undefined" ? "black" : fgcolor; var this_url,this_color,this_variable; //---------------------------------------------------------------- // Page Assembly //---------------------------------------------------------------- this_parameter = "fgcolor"; label("Foreground Color"); start_table(); this_color="red"; cell(this_color,url(this_parameter,this_color)); this_color="green"; cell(this_color,url(this_parameter,this_color)); this_color="blue"; cell(this_color,url(this_parameter,this_color)); end_table(); this_parameter = "bgcolor"; label("Background Color"); start_table(); this_color="yellow"; cell(this_color,url(this_parameter,this_color)); this_color="gray"; cell(this_color,url(this_parameter,this_color)); this_color="purple"; cell(this_color,url(this_parameter,this_color)); end_table(); label("Results"); show_results(); //---------------------------------------------------------------- // UI Helper Functions //---------------------------------------------------------------- function url(param,color) { var baseURL = "default.asp"; baseURL += "?" + param; baseURL += "=" + color; return(baseURL); } function start_table() { Response.Write(""); } function end_table() { Response.Write("
"); } function cell(color,url) { Response.Write(""); Response.Write(""); Response.Write(color); Response.Write(""); Response.Write(""); } function label(text) { Response.Write("
"); Response.Write(""); Response.Write(text + ":"); Response.Write(""); } function show_results() { Response.Write("
-
Frustrating - dialog in resource editor always resizes to top lefthere is the solution. uninstall. :). Apparently vs .net is so buggy that it should obviously be pulled off shelves. I think their should be an organization that test software products to ensure its bug free. I would always hope for a multi-zillion $$$ corporation such as microsoft to deliver their products bug free, however the world is mistaken... Which only prooves that open source software is much better, bug free, and delivered by excellent professionals who sit and work through the bugs correcting them. On the other hand microsoft overpays developer to work from 9-5 that jump out the doors at the sound of the last tick from the clock at 5.
-
opening two pages in a two iframes in one clickhow about creating an event handler and when the person say clicks a button one page loads, throw an event that then loads the next page
-
a query suing Time formatwhy not just use the LIKE clause. LIKE '15h00'. aren't dates stored as varchars, if not then you'd need to cast somehow. im just giving this advice from a programmers perspective