Problem with threading
Ok, i got my threading program to work i guess, but i had to change some of my code because it wouldnt work the right way with the threading. Lets say i called an if statment, and within that if statement i called the function that calls _beginthread. Well it would keep looping the if statement for some reason over and over again. I dont understand why that is. I got mos tof my code to work, but I had to change it to accomodate the threading.
Would you like to post some code?
I highly recommend Programming Applications for Microsoft Windows (Microsoft Programming Series) by Jeffrey Richter.
Ok here is the problem with my program, I think it is because im using multi-threading.
Anyways, the problem is, when the user clicks the station button in my program
the command "sta" should be sent to the server, which it is. Then the server should
send back the data which it does. I save the data in a file. It does that as well.
What the command does is get the network, stations, and channels from the server, in the form
of XX.XXX.XXX. So what i wanted to do is put the stations, networks, and channels in their
own file to save each one. So i used a string tokenizer to do that, but my program keeps crashing
I think it has something to do with using threading. But i could be wrong. But anyways
the beginning of my code is sending "sta" to the server. it goes to the do_commands function
and on line 230, the beginthread function starts. so we go into receive, and on line
365, the server copies the data from the server. Then after all this is done we go back to the
station function and we do the data_info function which does the tokenization, but
theres something wrong with the threading thats causing the receive function to act weird.
I can also upload you my program if you need it, its one file. This is also the last thing
i need to fix with my program, and its the most stressful basically because I dont know what to
do with it.
Anyways, heres the site where my code is located.
I think I figured it out. thanks anyways!
You should consider explaining what the problem was and how you fixed it, to help any others who might suffer from the same problem and come a'searchin in the future.
Oh well, I just used the debugger and I just put a counter in the receive function,and when it kept executing one statement the counter would remain 0, but when it finally broke out of the while loop, it would turn 1, and then we could execute the data_info function. and now it works