home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.internals
- Path: sparky!uunet!destroyer!gatech!hubcap!news
- From: rsaripa@venus.cs.clemson.edu (Saripalli Ramakrishna)
- Subject: Thanks to all those who replied But..............
- Message-ID: <1992Aug21.163253.22219@hubcap.clemson.edu>
- Sender: news@hubcap.clemson.edu (news)
- Organization: Clemson University Computer Science Dept.
- Distribution: na
- Date: Fri, 21 Aug 1992 16:32:53 GMT
- Lines: 43
-
- Hi,
-
- I really appreciate all those people who replied about the question
- I had regarding the read/write access of a socket for some
- related processes.
-
- What I really wanted was a sort of bus(say some channel) which all
- related processes could write/read from.
-
- One end of the bus could be set up by the parent before fork() but
- I am wondering how the other end could be set up.(It cannot be done
- by the children ,of course).
-
- I think I made the problem clear.Also it has to be some kind of socket.
- Also I feel that I need not use semaphores for the following segment
- could do it as well.
-
- ......
- do {
- recv(sock_id,(char *) buffer,3 * sizeof(int),MSG_PEEK)
- while (buffer.proc_id != getpid());
- /*Now remove it from the stream using read()*/
-
- I feel that the above segment would do as well(though it is a waste
- of CPU cycles) because all the processes would be executing this
- code (or at least one process) and only the process for which this
- message was meant would read the data and all others would be still
- in the while loop.(Correct me if i am wrong)
-
- Now this to happen,all the children must be sharing a common bus
- or channel or whatever so that recv() would succeed on it.
-
- In the above program segment,the control data is 3 words long
- and the receiver's identity is in it(say process id or whatever).
-
- I would appreciate if anyone could tell me how I could do it?
-
-
- Thanks a lot,
- Saripalli Ramakrishna
-
- e-mail : rsaripa@cs.clemson.edu
- Man is a beast and usually has no control over his passions.
-