Link to home
Start Free TrialLog in
Avatar of KarcOrigin
KarcOrigin

asked on

Design issue: How to handle multiple socket client with single socket server?

Dear Experts,
I have a socket server and multiple socket clients. How can my single socket server handle multiple socket clients simultaneously/concurrently? I am using MSWinSock control as server and client. I need to store number of socket client currently connected and their command requests and execute the commands and return the results to the requsted client command. What can be the good design to handle this issue?
Regards.
I am open to split the points for any good design(s)
ASKER CERTIFIED SOLUTION
Avatar of checoo
checoo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KarcOrigin
KarcOrigin

ASKER

Dear checoo and experts,

I do not have any control on the clients. Actually I am more interested of handling the client requests by the server only. Since MSWinSock can only handle one command at one time I need to implement the multiple simultaneously commands.

Consider the following case -
There are mulpitle clients connected to a socket server. For example clientA gives a command to scoket server and server return the result. This is fine. Now while processing the request of ClientA ClientB gave another command to the same server. Since the server and handle only one command at one time there must be some sort of Queue that has to be maintain or fulfill the requests in multitasking way. Can anyone suggest a good design to implement it?

Note: Just keep in mind that I cannot change the Socket Clients code what all I can do is with the Socket Server only. You can say that I want to make a multitasking or queue based Socket Server.

Regards.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dear checoo and GERENTE
Thank you very much for your comments. Applying your posted code I could'nt achive what I wanted to. Just to remind you guys that I wanted to process multiple clients request simultaneously...but your code gave me an idea and rest I used my own logic to achive my task.
Regards.