On Friday 12 February 2010 04:24:33 walt wrote:
> On 02/11/2010 03:03 PM, Volker Armin Hemmann wrote:
>  > ...
> > 
> > And don't start with sockets. That will result in a nightmare. dbus is a
> > clean solution to a huge problem. Apps have to talk to each other. The
> > only way to keep it sane is a standardized IPC daemon like dbus.
> 
> Aha!  This is a question that has confused me since I was still in diapers.
> (And may be in them again soon enough :)
> 
> Could you (or anyone else here) give us a really dumbed-down summary
> of why a dev would want/need to use a socket, versus a pipe, versus
> a signal, versus dbus, versus, well, whatever else is out there?

A pipe is a quick and dirty means of connecting two processes. Shove stuff in 
one end and it comes out the other end. What the other end does with it is up 
to the other end. A pipe (|) in a shell is the same thing, built for you 
automagically. Used within an app you must construct the pipe in code. An 
example would be reading a text file and inserting the line into a database. 
On the command line you would do

tail -f /path/to/data/file | /path/to/insert/script

A socket does the same thing in the style of networking as opposed to a raw 
pipe. All your local X clients do this, the X server created a socket and the 
clients plug into it. This is good because X is a networked gui system so you 
just do networking everywhere even if the server and client are on the same 
box.

You use dbus if any old app needs to get an idea across to any other old app 
and you don't know who is doing what. You are always aware of what is at the 
end of a pipe (you built the thing) but if your jabber client wants a 
notification to be sent of an incoming message, it doesn't know or care how 
this is done - that is up to the notification apps. This is analogous to 
posting to a mailing list and asking anyone who knows the answer to a question 
to please speak up.

A signal is a specific message you send to a specific process via the kernel. 
Send signal 15 to a process's PID and the kernel will relay it. The message 
will be interpreted as "shut yourself down now".

-- 
alan dot mckinnon at gmail dot com

Reply via email to