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.
aho1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

corvanderlindenCommented:
1. Do your clients all use the same class in the server

2. Is the class in the server single- or multiuse
0
GordonpCommented:
If the clients are using seperate instances of the Server Class ( ie each used set Server = new Server class )

then it is down to how you set the threading properties in the ActiveX Executable

As long as you have at least as many threads as clients then you have no problem.

each Instance runs simutaneosly but seperately. Both instances have there own copy of any global data so no semaphores etc. are required.

How many threads have you?

If you've set the Threading Model to Thread per Object your OK, your Exe will have a seperate thread for each instance.

If you've set it to Thread Pool then the number in the text box tells you how many threads you have.

If you only have 1 thread then its not FIFO but LIFO ( Last in First Out ).

If need more info let me know

Hope this helps

Gordon
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
corvanderlindenCommented:
If your shared data is for instance a file our a MMF you are in trouble anyway
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

aho1Author Commented:
Gordonp, Thanks for your reply.

Will the class instances execute simultaneously with the On_COMM Event that is in the server module?  

aho.
0
GordonpCommented:
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

0
corvanderlindenCommented:
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
0
aho1Author Commented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.