does anyone have an example of winsock multithreading in win32asm? like connecting to 10 different websites and sending/receiving data at the same time (or the illusion of it). thanks, - clip This message was edited by clip, on 5/5/2001 5:41:35 AM
Posted on 2001-05-05 01:45:00 by clip
I've found a way on how to do it. To those who are interested on how to do this. Let's say you want to connect to 10 different addresses of various date servers around the world and getting date info from each server at the same time. You just create a function for let's say connecting to a date server and getting date information from that date server then you call it via the api CreateThread. Now in order to connect to 10 different date server addrs at the same time, make separate functions that do the same thing only with different addresses to connect to and call them all via CreateThread (this technique eats alot of memory when you connect to many servers at the same time). - clip
Posted on 2001-05-12 01:54:00 by clip
It sounds like you made 10 different functions and 10 calls to CreateThread() specifying a different function each time. If your functions all do the exact same thing but have different addresses, then you are writing way too much code. The fourth parameter of CreateThread() allows you to pass a pointer to one argument that can be passed to your function. Use this to point to an sockaddr_in address structure. Then, put all ten of your address structures into an array. Now put the call to CreateThread() into a for() loop and increment the array index each time. This will save a lot of coding.
Posted on 2001-05-15 10:54:00 by Quacker
Quacker, Yes, eventually I have found out about that one too (the 32 bit parameter). This concept would produce a same or longer or shorter :) code I think heh: in a loop convert each ip (resolve first if it's a domain name) in a hostlist with inet_ntoa() and pass the result as the 32 bit parameter of CreateThread() with the function that does the connection and session. cheers, clip X.S. the first post that ive made could be done in same amount of time as with our newer revisions (with the help of copy and paste ;)).
Posted on 2001-05-16 07:07:00 by clip