Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!decwrl!claris!outpost.UUCP!peirce From: peirce@outpost.UUCP (Michael Peirce) Newsgroups: comp.sys.mac.programmer Subject: Re: AppleTalk - ATPCloseSocket Message-ID: <0B010004.q6ucfa@outpost.UUCP> Date: 15 Mar 91 21:42:28 GMT Reply-To: peirce@outpost.UUCP Organization: Peirce Software Lines: 46 X-Mailer: uAccess - Mac Release: 1.0.3 In article <2859@sparko.gwu.edu>, rjohnson@seas.gwu.edu (Ray Johnson) writes: > > I open up a socket and name it useing ATPOpenSocket and PRegisterName and > everything seems fine with no errors. However, when I try to close the > socket with ATPCloseSocket I get the error badATPskt (-1099). Why would > it be giving that error? Anyone? Anyone? Well, it thinks that the socket you gave it isn't an valid ATP socket. Why would it think that? Couple of things come to mind: (1) the socket's already closed, (2) the socket you passed it isn't the socket you opened... Also, I'd recommend using the "new" preferred versions of the open/close socket calls. I doubt the old ones are the trouble, but it's possible. Heres some code fragments from my own code that work... To open a socket: WITH gInATPPB DO BEGIN atpsocket := 0; {ask for any available} addrBlock.aNet := 0; addrBlock.aNode := 0; addrBlock.aSocket := 0; END; gStat := POpenATPSkt(@gInATPPB,kSYNC); IF gStat <> noErr THEN BEGIN GoOnline := FALSE; EXIT(GoOnline); END; gSocket := gInATPPB.atpSocket; To close that same socket: gInATPPB.atpSocket := gSocket; gStat := PCloseATPSkt(@gInATPPB,kSYNC); -- 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