rjohnson@seas.gwu.edu (Ray Johnson) (03/15/91)
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? -- Ray Johnson Internet: rjohnson@seas.gwu.edu Phone: (202)994-6853 The George Washington University
peirce@outpost.UUCP (Michael Peirce) (03/16/91)
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
andyp@treehouse.UUCP (Andy Peterman) (03/19/91)
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? This is a long shot, but try changing the entry for that call in Appletalk.h so that you're passing a short instead of a char. For example, the line should read: pascal OSErr ATPCloseSocket(short atpSocket); ^^^^^ I'm not sure if this is the problem, but it may fix it. I had a similar problem with DDPCloseSocket and, while tracing the code, found that the library routine pulled a word (16 bit value) off the stack. I have since found a work-around and never tried fixing it this way. Let me know if it works - I've been meaning to test it and pass it on to MPW.BUGS at Apple if there is indeed a problem. -- Andy Peterman | Opinions expressed treehouse!andyp@gvgpsa.gvg.tek.com | are definitely those of (916) 273-4569 | my employer!