messages between processes
phil-news-nospam_at_ipal.net
Date: 03/25/05
- Next message: James McIninch: "Re: Newbie Query"
- Previous message: brianmwaters_at_gmail.com: "Re: FAT filename inconsistencies"
- Next in thread: Pete Zaitcev (OTID3): "Re: messages between processes"
- Reply: Pete Zaitcev (OTID3): "Re: messages between processes"
- Reply: David Schwartz: "Re: messages between processes"
- Reply: Joe Bloggs: "Re: messages between processes"
- Maybe reply: phil-news-nospam_at_ipal.net: "Re: messages between processes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Mar 2005 21:15:12 GMT
I've been looking for a means whereby I can have multitudes of processes
send messages amongst themselves. The catch is that I need to be able
to direct the message to a specific process based on its PID. So what
I first thought of was to have each process listen for a UDP datagram
where the port number is the process ID. But that has problems because
of the way many ports are used, and ports < 1024 are unavailable. Then
I came up with this crazy idea. At first I thought it can't work due to
the addresses involved. But I recalled seeing something using such an
address at one time, so I figured I'd check. It actually seems to be
working.
The idea is that each process will take its process ID and and specific
port number and bind the socket to address calculated by adding the PID
to 127.0.0.0. Thus PID 515 would bind to 127.0.2.3 with that port. Any
process needing to send a message to PID 515 in this context would send
a UDP datagram to 127.0.2.3 at that port. I've tested binding a couple
processes like this. Then I sent messages to each and they go to the
proper process. The only addresses I cannot bind are 127.0.0.0 and
127.255.255.255 but that won't matter (PID 0 and PID 1 won't be involed
in this, and currently there are no PIDs above 65535).
So now the questions:
Is it supposed to work like this, even though no interface has been
configured for the IPs I'm binding to? Note that I am doing this with
non-root processes.
What is the chance this capability would be removed in the future version
of the kernel?
What is the prospect of PIDs > 16777214 in the future (32 bit stuff)?
Will something like this work in IPv6 with an even wider range of
addresses that can be used? (especially in case of 32 bit PIDs)
Here is some netstat output. I'm not associating PID to address at this
point, but just showing that I can bind many addresses locally:
udp 0 0 127.0.1.7:1234 0.0.0.0:* 21670/sock
udp 0 0 127.0.1.6:1234 0.0.0.0:* 21666/sock
udp 0 0 127.0.1.5:1234 0.0.0.0:* 21661/sock
udp 0 0 127.0.1.4:1234 0.0.0.0:* 21656/sock
udp 0 0 127.0.1.3:1234 0.0.0.0:* 21651/sock
udp 0 0 127.0.1.2:1234 0.0.0.0:* 21646/sock
udp 0 0 127.0.1.1:1234 0.0.0.0:* 21642/sock
udp 0 0 127.0.1.0:1234 0.0.0.0:* 21638/sock
FYI, I do _not_ want the processes that will be communicating with lots of
other processes to have to have a zillion socket file descriptors open to
be able to distinguish which process sent the message, and to direct the
reply back to that process. This setup seems like it would allow each
process to have just one socket for this using sendto() and recvfrom().
-- ----------------------------------------------------------------------------- | Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ | | (first name) at ipal.net | http://phil.ipal.org/ http://ka9wgn.ham.org/ | -----------------------------------------------------------------------------
- Next message: James McIninch: "Re: Newbie Query"
- Previous message: brianmwaters_at_gmail.com: "Re: FAT filename inconsistencies"
- Next in thread: Pete Zaitcev (OTID3): "Re: messages between processes"
- Reply: Pete Zaitcev (OTID3): "Re: messages between processes"
- Reply: David Schwartz: "Re: messages between processes"
- Reply: Joe Bloggs: "Re: messages between processes"
- Maybe reply: phil-news-nospam_at_ipal.net: "Re: messages between processes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|