larryd@smurf.enet.dec.com (George Domenikos) (05/08/91)
Hi there, I need to write some sort a Macintosh server code that listens for incoming requests and performs certain action based on those requests. I probably know how to write the listener part but I am still having tremendous difficulties with Inits. Does anyone have an example of such an INIT? I have not been able to obtain any sample code regarding this matter from apple. thanks in advance george domenikos
peirce@outpost.UUCP (Michael Peirce) (05/08/91)
In article <4728@ryn.mro4.dec.com>, larryd@smurf.enet.dec.com (George Domenikos) writes: > > Hi there, > I need to write some sort a Macintosh server code that listens for incoming > requests and performs certain action based on those requests. I probably know > how to write the listener part but I am still having tremendous difficulties > with Inits. Does anyone have an example of such an INIT? I have not been > able to obtain any sample code regarding this matter from apple. What type of listener are you planning? Will it use ATP? ADSP? DDP(ick)? I have an example in my soon to be released book, Programming with AppleTalk, that is an RDEV/INIT that installs an ATP listener at startup time. I can't post is here right now, as I'm still negotiating with the publisher about how the source code can be distributed, but I can send you a copy for your personal use if you want. The example uses ATP, but the principles are the same for ADSP as well and frankly, if yo are sending much data at all, ADSP probably would be the best choice of a protocol. My example uses two seperate code resource: an INIT that does the installation of another code resource and the other code resource that lives in the system heap and responds to requests. You make the call to PGetRequest in the INIT and point the ioCompletion routine to the start of the other code resource (after you lock in memory and detatch if from the resource map). When a request comes in the completion code is called at interrupt level (play by those rules) and you process it. Just make sure to issues another PGetRequest before you give up control. Hopefully I can release the source code here some time soon. -- michael -- Michael Peirce -- outpost!peirce@claris.com -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California 95117 -- & Consulting -- (408) 244-6554, AppleLink: PEIRCE