Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

client-server

Posted on 2006-04-03
6
Medium Priority
?
240 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
0
Comment
Question by:tech1guy
  • 3
  • 3
6 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 16364158
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;
//...
};
0
 

Author Comment

by:tech1guy
ID: 16364688
could you please explain that in some detail as I'm NOT a expert in client-server programming.
0
 
LVL 86

Expert Comment

by:jkr
ID: 16364718
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tech1guy
ID: 16365438
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?
0
 
LVL 86

Expert Comment

by:jkr
ID: 16365699
Yes, you only need to store the data for each connection seperately, regardless of how you maintain the communication itself.
0
 

Author Comment

by:tech1guy
ID: 16366242
thanks! it helps
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question