We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

client-server

tech1guy
tech1guy asked
on
Medium Priority
256 Views
Last Modified: 2010-04-15
Hi experts,
I've a simple client and server in C on unix platform. The server displays the date in 'mm/dd/yy' OR 'dd/mm/yy' format depending upon the requested format by client.
It's running absolutly fine, but it's for single client. Now, I'm trying to implement it for multiple clients using select(), it's going fine, but is it possible for server to remember the choice for every client?
I mean can the server remember which client requests date in which format?

Thanks in advance
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2012
Commented:
All you need to do is to associate the clients with their 'context data'. I'd use a struct for that, e.g.

struct client {

socket s;
unsinged int format;
//...
};

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
could you please explain that in some detail as I'm NOT a expert in client-server programming.
jkr
CERTIFIED EXPERT
Top Expert 2012

Commented:
Well, your problem is that you some sort of connection set up (I was assuming a socket in the above) and need to associate data (settings in your case) with that connection. So you have to somehow 'bundle' that information, and that's where structs come in handy.

Author

Commented:
I'm not closing connection after each client is served. I'm using Select()method instead of Fork. Will your technique work with my scenario?
jkr
CERTIFIED EXPERT
Top Expert 2012

Commented:
Yes, you only need to store the data for each connection seperately, regardless of how you maintain the communication itself.

Author

Commented:
thanks! it helps
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.