Constructing a server daemon / questions on handling clients


 
Thread Tools Search this Thread
Top Forums Programming Constructing a server daemon / questions on handling clients
# 1  
Old 04-19-2009
Question Constructing a server daemon / questions on handling clients

Hi All,

I'm interested in the best way to serve multiple clients from a server process.

Now, our server is going to serve data on a custom protocol and it is going to get / process that data from a number of possible back-ends including files (text or xml) and MySQL/some other database. Then, it's going to respond to possibly multiple users.

My linux programming book suggests two methods: fork() in the main while loop of the server so that each client ends up with a thread to handle its request and checking file descriptors for new connection requests.

I'd like my server to be able to respond to multiple lookup requests and possibly multiple updates; there is some scope for the database being read-write, from multiple clients. So, what's the best way to attack this problem? As suggested above, or a different way? I understand there is an issue if two threads attempt to open the same resource (database or whatever) with write privileges (one should fail). I thought about creating a transaction queue for writes with a separate thread processing this. The single thread process doesn't have this problem, of course, but then if intensive work is being done per client (possible) surely the speed at which clients are served becomes a problem.

This is likely to be using AF_INET sockets i.e. over the net.

Basically I'm not sure how to proceed; any thoughts / comments are most welcome. I'd rather not just write the code then have to change it because I didn't ask first.

Thanks in advance,

Dragonfly

P.S. Not a homework problem (I am a student), my degree is in Mathematics!
# 2  
Old 04-19-2009
Hint: check out select(2)
# 3  
Old 04-29-2009
Hello,

Thanks for that... it looks like the method my programming book suggests as the most efficient method, all done on one process. I assume then that multiple clients will be able to connect without any issues.

Thanks again,

Dragonfly
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unmounting NFS idle clients from server

Hello World, We have a software repository server in our environment which we use as an NFS server. Now this has been going on well before I was hired. Now, I observed many users not unmounting the NFS resources after their use. I ran showmount and it showed 513 current sessions. :wall: Is... (7 Replies)
Discussion started by: satish51392111
7 Replies

2. Programming

Clients - Server ( UDP )

Hello, I have a question: I want to create a n client to one server connection. This is the client-server algorithm. Enybody help to make the changes? (0 Replies)
Discussion started by: MaHmur
0 Replies

3. IP Networking

Some clients cannot ping UNIX server

All of sudden in this morning, some computers could not connect to our UNIX server while other still could. Some computers could ping the server while some could not. Same on the server side. It could ping some clients but not some. All Windows clients could ping each other. And more, the... (1 Reply)
Discussion started by: jonapa
1 Replies

4. UNIX for Advanced & Expert Users

Quest on NFS with 1 Server & 2 Clients

Hello; I work now with a team which has based her "applications" on the following schema: 1 NFS client C1 (linux redhat 5) writes a file fic.dat on a NFS SERVER S (RH 5) Another NFS client C2 is waiting for the same file fic.dat (on NFS server S1), and, when "fic.dat" appears, then makes... (8 Replies)
Discussion started by: SolarMax
8 Replies

5. Filesystems, Disks and Memory

Backup apps for Windows server, linux clients?

Hi guys. What would you recommend me a software running on Windows, and it is capable for backing up Windows and Linux (unix is optional) machines? The application should have following features: - Encryption. - Authentication - Open source if possible :) ... I found Amanda, but it... (1 Reply)
Discussion started by: bsddaemon
1 Replies

6. AIX

IPsec from one AIX server to many windows clients

I work for a fairly large organization who recently tasked me with securing our telnet services with IPsec. We have a large mixed environment where most of our servers are running unsecured telnet. ssh was my first suggestion but because of the cost of purchasing an enterprise license for a fips... (2 Replies)
Discussion started by: dgaixsysadm
2 Replies

7. AIX

NTP server with aix & wintel clients

Good morning to all, can someone advise me how to setup aix ntp server with aix & wintel clients? Secondly, I also require to enable the service to autostart on reboot, how do I configure this? Thirdly, how do I configure daily autosync between clients and server? Please advice, thanks.... (0 Replies)
Discussion started by: chongkls77
0 Replies

8. UNIX for Dummies Questions & Answers

Map Drive from UNIX Server to Windows Clients

hi all ;; I have a Tru64 UNIX machine , first i want my employees ( windows clients) to see specific directory on unix , and how can i put a unix command in a visual basic code to copy the contents of that directory to drive c in the client side who request that by clicking a push button. ... (3 Replies)
Discussion started by: kafaween
3 Replies

9. Cybersecurity

List of HTTP/FTP-clients on a server

The other day, a friend of mine had his Linux webserver compromised because he was running a vulnerable PHP-script. The "hacker" had used a malformed URL to include a wget-command to fetch some stuff off the net and install it in /dev/shm where it ran undetected. Fortunately, the webserver ran as a... (2 Replies)
Discussion started by: indo1144
2 Replies

10. Solaris

Solaris 8 server and Jumpstarting 2.6 clients

Ladies and Gentlemen: I have successfully configured a Solaris 8 server with Jumpstart! I can Jumpstart Solaris 8 client systems with no problem. My configuration is as follows: Jumpstart Server: Solaris 8 patched with Recommended Patches from June 05. I have installed Solaris 8 in... (4 Replies)
Discussion started by: rambo15
4 Replies
Login or Register to Ask a Question