Path: utzoo!mnetor!uunet!nuchat!peter From: peter@nuchat.UUCP (Peter da Silva) Newsgroups: comp.sys.amiga Subject: Re: IPC (1): Ports & Messages Message-ID: <752@nuchat.UUCP> Date: 9 Mar 88 02:29:45 GMT References: <7412@agate.BERKELEY.EDU> Organization: Public Access - Houston, Tx Lines: 45 Keywords: InterProgram Communication, tools Summary: A rationale for a message broker. Good call on the task going away. For the case of the Browser messages I suggested the other day I don't think that it's a problem. (1) You can lock before sending any messages to the browser: there are only going to be two messages from you to it in any two-way conversation, anyway: 'ADDT' or 'ADDW' and 'DELT' and 'DELW'. (2) You're supposed to tell Browser before you go away. If you always do this, but check that *it* hasn't gone away before doing so, there's not going to be a problem. Now, as to a general message server. I don't like the idea of a reply port being enything but a reply port, but you can always pass a port as part of the message. We can make the assumption that *it* isn't going to go away, ever. So: You find it with the call FindPort("SERVER"); You can have two roles. You can be a master or a slave. If you want to be a master, you send 'ADDM', your id, and a message port. Server adds you to its list and replies. You are now registered. Before you can go away you have to send it 'DELM'. It will then send 'DELM' to all the slaves it knows you're talking to, and when it gets all their replies it replies to you. If you want to be a slave, you send 'ADDS', the master id, and a message port. Server looks up the master in its list, adds you to the list of active slaves, and forwards it your 'ADDS' message. The master's replies go back to you... the server doesn't care. If the master doesn't exist, of course, it just replies immediately with a failed status. When you want to disconnect you send your master 'DELS' and it takes you out of the list and forwards your message to the master. Once again the master replies to you. And of course if you ever get a 'DELM' message you reply to it and forget you ever heard of the master. This seems to have very little overhead. What do you all think? -- -- a clone of Peter (have you hugged your wolf today) da Silva `-_-' -- normally ...!hoptoad!academ!uhnix1!sugar!peter U -- Disclaimer: These aren't mere opinions... these are *values*.