home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!comp.vuw.ac.nz!waikato.ac.nz!ldo
- From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: PPC Sessions, or Any ports in this storm?
- Message-ID: <1992Dec16.172127.12835@waikato.ac.nz>
- Date: 16 Dec 92 17:21:27 +1300
- References: <1ghueaINNnuf@flop.ENGR.ORST.EDU>
- Distribution: world
- Organization: University of Waikato, Hamilton, New Zealand
- Lines: 46
-
- In article <1ghueaINNnuf@flop.ENGR.ORST.EDU>, kempkec@mist.CS.ORST.EDU (Christopher Kempke) writes:
- >
- > First a simple question: Can I assume that PPC Session reference numbers
- > are unique to a running application?
-
- I think that session and port numbers are unique systemwide, not just to an
- application. I've been doing some messing about with PPC from HyperCard,
- and several times I've made some mistake in a script, tried quitting HyperCard
- and going back in, and failed to open my port because it was already open.
-
- Remember the PPC Toolbox can be used from interrupt level and INIT code, not
- necessarily by an application. I don't think it knows anything about
- application contexts; that knowledge belongs to higher layers, like the
- High-Level Event and AppleEvent Managers.
-
- > Worse, the ReadParam and WriteParam (why the name change from send/receive
- > to write/read, guys?) don't include the port reference number. The
- > only thing I can consistently get is the session reference number, and
- > of course there's two big problems with that: a) it's not documented to
- > be unique, so I can't necessarily map it back to the port number, and
- > b) there's no obvious way to convert them, short of building a table myself
- > as I open the sessions, and c) the session reference number is not even
- > listed as being a readable value in the completion procedure, so potentially
- > in a later system it could be corrupted or overwritten by the time it reaches
- > the completion routine.
-
- I haven't heard of any cases where the system altered a field where there
- was only a right-arrow next to its description. I trust this is still true
- with the PPC Toolbox. (He said with a straight face.)
-
- > Is there really no way to do this? I _can't_ be the only person who
- > needs to send data from the application to its own completion routines.
- > Can I?
-
- One common technique is to make the PPC parameter block part of a larger
- structure that you know about. You can put whatever information you like in
- the fields following it.
-
- There's another technique I like to use (because it also works in more
- difficult situations), but it involves generating code at run-time, which
- upsets some squeamish types. :-)
-
- Lawrence D'Oliveiro fone: +64-7-856-2889
- Computer Services Dept fax: +64-7-838-4066
- University of Waikato electric mail: ldo@waikato.ac.nz
- Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
-