aho1
asked on
Class execution help
Hi,
I have a working client/server (Active X) system at the moment, but don't quite have the pc's to perform/"know how" this little test.
If clients simultaneously attempt to execute functions on their respective server class instances, which of the following will it do ?
1. One client complete it's transaction before the next is started, ie FIFO.
2. Execute them both simultaneously.
If it is case 1 then there is no problem. If it is case 2, that is another matter. I would need to implement semaphores to ensure that another client doesn't poison the shared data another instance could be working on.
Thanks in advance.
aho.
I have a working client/server (Active X) system at the moment, but don't quite have the pc's to perform/"know how" this little test.
If clients simultaneously attempt to execute functions on their respective server class instances, which of the following will it do ?
1. One client complete it's transaction before the next is started, ie FIFO.
2. Execute them both simultaneously.
If it is case 1 then there is no problem. If it is case 2, that is another matter. I would need to implement semaphores to ensure that another client doesn't poison the shared data another instance could be working on.
Thanks in advance.
aho.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If your shared data is for instance a file our a MMF you are in trouble anyway
ASKER
Gordonp, Thanks for your reply.
Will the class instances execute simultaneously with the On_COMM Event that is in the server module?
aho.
Will the class instances execute simultaneously with the On_COMM Event that is in the server module?
aho.
If both are trying to listen to the same comm port, then you may have a problem.
As I said each instance sits on its own thread with its own copy of the global data, this includes forms , AND controls.
So you now in effect have two MSComm controls trying to access a single comm port.
It wont work I'm afraid. You may need to stick with a Single Thread ( Thread Pool of 1 ) and set up a Queing system to get FIFO instead of LIFO.
Gordon
As I said each instance sits on its own thread with its own copy of the global data, this includes forms , AND controls.
So you now in effect have two MSComm controls trying to access a single comm port.
It wont work I'm afraid. You may need to stick with a Single Thread ( Thread Pool of 1 ) and set up a Queing system to get FIFO instead of LIFO.
Gordon
Sorry guys, but I said it before: if you are sharing 1 resource (file, port or whatever) you have a problem and should implement a pooling object or use semaphore or mutex
ASKER
Guys,
Assuming I use the pooling object method.
Is it possible to maintain a data received/sent/waiting queue in a module (as single instance) that opens the COMM port once and all the other class instances read data from those queues'.
If so, I might try to implement such a queue system,
- Timestamp and ID all requests.
- Place COMM sent/receveived in another queue
- Prioritise data queues, for instance all COMM recevied data would be treated as highest priority.
Also where are some good semaphore implementation examples, I haven't seen it implemented under vb before.
Thanks, aho.
Assuming I use the pooling object method.
Is it possible to maintain a data received/sent/waiting queue in a module (as single instance) that opens the COMM port once and all the other class instances read data from those queues'.
If so, I might try to implement such a queue system,
- Timestamp and ID all requests.
- Place COMM sent/receveived in another queue
- Prioritise data queues, for instance all COMM recevied data would be treated as highest priority.
Also where are some good semaphore implementation examples, I haven't seen it implemented under vb before.
Thanks, aho.
2. Is the class in the server single- or multiuse