Thanks Peter and Andrew, I'll try to explain better. The program will
send fields from the records w/o a val_code to the remote server (it's a
soap web service kinda thing but this should be unimportant as it is set
in stone and I have the code necessary to send/receive available) the
response could take milliseconds or several seconds. Records need
processing very quickly. They allow me to have 5 "sessions" (that's the
server folks word for it) open with their server at the same time. I
don't have to wait for the first request to come back to submit another
I can submit up to 5 at a time but each request is done in a seperate
"session" or connection to the server. The only way I see having 5
sessions open on one pc at a time is multiple programs or multiple
threads. Threads being my choice.
I've been thinking since I asked the question (dangerous, I know) and I
see a main thread that launches 5 worker threads. Each worker thread
creates a session and logs in to the server. The main thread meanwhile
pulls a group of records needing validation from the sql server. Then
as long as it has records starts a loop checking to see if worker thread
1 is busy, if thread 1 is the main thread checks worker thread 2, if
it's busy 3 and lets say 3 isn't so it passes the record to worker
thread 3. then picks the next record and check to see if 1 is busy then
2 etc. Each thread would be responsible for updating the sql database
with the changes to the record it was assigned.
To do this I need to know:
--how to reference a thread ie how to know which thread is 1, 2, 3 etc.
--how to set a busy indicator in a worker thread and how to read it
from the main thread
--how to assign a thread a record
cj wrote:
I have to take all records in a SQL db that have an empty val_code field
and process and update the records with a code number in the val_code
field.
The processing is done by sending select info from each record to a
remote server. The remote server returns the code number to be put in
the val_code field. The remote server will allow me to have up to 5
"sessions" open with it at a time.
I'm thinking each "session" will have to be in a separate thread. I
also assume a main thread must exist to interact with the database. Can
anyone give me any other ideas?
Thanks.