Write command in named pipes
Hi:)
I have a problem. i am writing this program. It works between Client and The server. The Server Listens to a namedpipe .whenever a client comes up and wants to login , The client is asked for it's userid. This user id has to be written in the named pipe(that has already been opened) and be sent to the server. The server is going to creat another exclusive named pipe with this information for this user. My question is that i don't know how to write userid in named pipe and how to create exclusive named pipe for this user according to this userid. Thanks so much |
First of all. what language are you developing in?
Second, do you not intend to use this over the network? If so you may want to redesign using sockets now, as it will be more difficult to do it later if you need your app networked. Third, to send data to a pipe you simply open it as a file object and write to it. Here's a trivial example using bash and python: Code:
...from shell 1 |
Hi
first of all thank you. I am using C . |
Quote:
Quote:
|
Thank you for the responce
|
You send data over the pipe. You decide what it means.
If it's a user id then it's a user id. you can call your named pipe whatever you want. (lay off /dev/tty /dev/sound /boot/vmlinuz tho) I agree though, may just as well use sockets, not much more work but more flexible approach. fifo's are ok for shell scripts. |
Quote:
|
and don't forget to send a newline to flush the data through each time.
you'll sit there waiting for hours! |
All times are GMT -5. The time now is 02:33 AM. |