Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!tank!nucsrl!accuvax.nwu.edu!jln From: jln@accuvax.nwu.edu (John Norstad) Newsgroups: comp.sys.mac.programmer Subject: Re: Init and DA... Message-ID: <10050060@accuvax.nwu.edu> Date: 19 Dec 88 19:15:25 GMT References: <19709@ames.arc.nasa.gov> Organization: Northwestern U, Evanston IL, USA Lines: 43 Brad Soe asked about writing an INIT to notify users of new mail. It wasn't clear whether the mail machine is sending you unsolicited packets notifying you of new mail, or whether you want to periodically poll the mail machine and ask if it has new mail. If you want to poll, you should write an INIT that opens a socket for the polling and installs a VBL task. The VBL task wakes up periodically, sends a message to the mail machine out the socket, and waits for a reply. If and when a reply arrives saying that there is in fact new mail, the VBL task calls the notification manager to alert the user. If you don't want to poll, just wait for notification packets, then you should write an INIT that opens a socket and installs a pair of completion routines in the system heap. You need an ATPGetRequest completion routine and an ATPSendResponse completion routine. The ATPGetRequest completion routine waits for notification packets to arrive. When one arrives, it calls the notification manager to alert the user and sends a response. The ATPSendResponse completion routine waits for the response to be acknowledged (I'm assuming you're using exactly once service), and issues the next GetRequest. The INIT issues the first GetRequest. In both of these scenarios you must use asynchronous AppleTalk calls, which requires at least some assembly language glue. There's no need for a DA in either of these cases. You can call the notification manager from a VBL task or completion routine without having to specify an application or DA. It's all fairly complicated, but doable. I have a half-finished AppleTalk program which uses the second scheme above. The INIT is in MPW C, while the completion routines are in MPW Assembler. You're welcome to a copy of my code. The INIT and completion routines are finished, debugged, and pretty well documented. Write to me if you'd like a copy. John Norstad Academic Computing and Network Services Northwestern University Bitnet: jln@nuacc Internet: jln@acns.nwu.edu