connecting two process through a socket

Donn Cave donn at
Mon Mar 3 18:40:47 CET 2003

Quoth mixo <mixo at>:
| What I am trying to do is combine two daemons. The first
| daemon logs is status in various ways: file,syslog and status
| files which take the form /path/to/status/dir/currentpid/file.
| The other daemon is a threading tcpip server which listen on
| port 3030 (configurable). The problem I have here is that I
| need to get the pid of the first daemon so that second daemon
| can feed data to clients.
| So, what I am considering is having the first daemon send data to
| the second through a socket. Is there a way to have the two
| daemons connected this way, and having the second daemon
| shutdown when the socket is closed? And how can I make sure
| that clients do not connect to the first daemon, only the second?
| In other words, can I have a socket server that is connected to
| another server as a client?

As near as I can make out what you're asking, the answers are
yes, don't worry, and yes.  The distinction between server and
client isn't very useful here, any process can bind a socket
and accept connections like a server and any server is likely
to make client-like connections for authentication, directory
service, etc.  Shutdown on close will only happen if the program
logic of the second daemon dictates it, but it wouldn't seem to
pose any problem.  Did something go wrong when you tried it?
I don't get what this has to do with the pid of the first daemon.

	Donn Cave, donn at

More information about the Python-list mailing list