Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!rex!uflorida!atlantis.cis.ufl.edu!leh From: leh@atlantis.cis.ufl.edu (Les Hill) Newsgroups: comp.unix.programmer Subject: Re: Berkley sockets Message-ID: <27642@uflorida.cis.ufl.EDU> Date: 25 Mar 91 19:05:22 GMT References: <1991Mar14.193619.21766@m.cs.uiuc.edu> <1991Mar13.190847.9755@watdragon.waterloo.edu> <1991Mar14.122151.21216@virtech.uucp> <16730@uudell.dell.com> <1991Mar19.202408.14706@m.cs.uiuc.edu> Sender: news@uflorida.cis.ufl.EDU Reply-To: leh@atlantis.cis.ufl.edu (Les Hill) Distribution: na Organization: U of Florida. Computer Science Dept. Lines: 32 In article <1991Mar19.202408.14706@m.cs.uiuc.edu>, carroll@cs.uiuc.edu (Alan M. Carroll) writes: |> There's a number of reasons for not doing it that way. The program |> that I am writing is a "software bus", which accepts messages from a |> set of clients, and routes those messages to the set of clients that |> are interested in them. Each client connects to the bus via a scoket, |> which is used to send messages to other clients, and receive them. |> 3. Because of the nature of the program, data from any socket can have |> a need to be sent to an arbritrary subset of all the other sockets. In |> order to do this using child process, each child process would have to |> have a means of communicating with either all the other child |> processes (and detect when any of them exited), or with the parent |> process which would then forward the messages. The former is too ugly |> to even discuss*. The latter can't work, because it brings us back to |> the original problem - how does the parent move the data when it's |> hanging on an accept? |> -- |> Alan M. Carroll "I hate shopping with the reality-impaired" |> Epoch Development Team - Susan |> CS Grad / U of Ill @ Urbana ...{ucbvax,pur-ee,convex}!cs.uiuc.edu!carroll As it happens, I have just been putting the final touches on a library which uses sockets to allow communications to any one peer or all peers; clearly, the leap to any subset is routine matter. Ignoring the origins of this library for the moment, the scheme I used could be modified from its completely distrubuted control system into a client/server system to meet your needs. To give you the short answer, use select in your server (or software bus) and for every client use a SIGIO handler (obviously after setting the socket connection to the server for async.) As the SIGIO handler is invoked read in the data from the server and store it, use a netread() (or some such routine) to access the stored data as your client needs it, writes can be made di rectly to the server. [Obviously, a protocol of some sort needs to be used between the clients and the server -- I am guessing that you already have most of it ironed out.] If the idea of SIGIO scares you, you could use select or fork off a child that would handle the network connection (and communicate via a pipe or some such.) -- Extraordinary crimes against the people and the state have to be avenged by agents extraordinary. Two such people are John Steed -- top professional, and his partner, Emma Peel -- talented amateur; otherwise known as "The Avengers." UUCP: ...!gatech!uflorida!leh BITNET: vishnu@UFPINE INTERNET: leh@ufl.edu