Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Piping in client-server architecture
Index -> General Discussion
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Geminias




PostPosted: Fri Feb 29, 2008 11:35 am   Post subject: Piping in client-server architecture

Hi, just to clarify, is a limitation of piping the fact that you can't have multiple clients? I think you can only have one stdin and one stdout so I dont see how you could create a FIFO connected to the stdin of the same program from multiple other programs.
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: Fri Feb 29, 2008 11:50 am   Post subject: Re: Piping in client-server architecture

Geminias @ Fri Feb 29, 2008 11:35 am wrote:
Hi, just to clarify, is a limitation of piping the fact that you can't have multiple clients? I think you can only have one stdin and one stdout so I dont see how you could create a FIFO connected to the stdin of the same program from multiple other programs.
I believe that the "clients" end up competing for the input. It is possible to have a program that takes stdin and writes to multiple pipes, buffers and/or files (allowing you to have "multiple client"-like behaviour).
Geminias




PostPosted: Fri Feb 29, 2008 3:14 pm   Post subject: RE:Piping in client-server architecture

But how could you attach multiple pipes to a single program's stdin? I can see how you can create multiple pipes to talk to multiple programs from one program, but how, as one program, can you receive input from multiple pipes talking to you? I thought that the "connection" was really just fifo object's descriptor writtin as the stdin field of the process descriptor block. Therefore I dont get how you could have multiple pipes as your input (unless you didn't use stdin but a named pipe that you read from programmatically from within the application).
OneOffDriveByPoster




PostPosted: Fri Feb 29, 2008 3:22 pm   Post subject: Re: RE:Piping in client-server architecture

Quote:
I dont see how you could create a FIFO connected to the stdin of the same program from multiple other programs.
Missed that the first time.
ali_dada




PostPosted: Wed Apr 23, 2008 8:09 pm   Post subject: Re: Piping in client-server architecture

Use should use the client/server architecture.

The idea is as follows:

Your server has a FIFO of its own.
The client has its own FIFO.

When the client writes to the server, the client passes the name of its FIFO to the server along with the query to be performed by the server.

The server reads from the client. It then opens the client's FIFO. It than performs the required operations and returns the answer by writing to the client's FIFO. After that, the server closes the client's FIFO and goes to waiting for the next request by a client.

For synchronizing (so only 1 client communicates with the server at a given time), set up a second FIFO for the server which the client will read from before sending server its request. This second FIFO can simply give out 2 values: 1 if busy (so the client waits) and 0 for go ahead.
Display posts from previous:   
   Index -> General Discussion
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: