Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!mips!apple!austing From: austing@Apple.COM (Glenn L. Austin) Newsgroups: comp.sys.mac.programmer Subject: Re: How Do You CTB CMListen()? Message-ID: <44368@apple.Apple.COM> Date: 29 Aug 90 05:12:20 GMT References: Organization: Apple Computer Inc., Cupertino, CA Lines: 42 time@tbomb.ice.com (Tim Endres) writes: >I am using the CTB for AppleTalk ADSP communications, and >am having difficulty with the ADSP connection ritual. >On the server side, I am doing something like: >{ > CMNew() > CMListen(ASYNC); > while (NOT accepted) > { > CMStatus() > if (statusListenPend == FALSE && statusIncomingCallPresent == FALSE) > { > printf("ERROR listener closed unexpectedly."); > } > else if (statusIncomingCallPresent == TRUE) > { > CMAccept(); > accepted = TRUE; > } > } > Communicate..... (Calls to CMRead(), CMWrite(), CMConfig(), etc...). >} As I recall... statusListenPend and statusIncomingCallPresent are NOT linked together. Remove the "&& statusIncomingCallPresent" from the first test. If the ListenPend is false, it doesn't matter what the IncomingCallPresent bit is and vice versa. In fact, unless you explicitly call CMClose on an infinite CMListen (timeout = -1), Listen should (and does) go on forever! -- ----------------------------------------------------------------------------- | Apple Computer has no connections with any of my postings. | ----------------------------------------------------------------------------- | Glenn L. Austin | "Turn too soon, run out of room, | | Auto Racing Enthusiast and | Turn too late, much better fate" | | Macintosh Programmer | - Jim Russell Racing School Instructors | | Internet: austing@apple.com | "Drive slower, race faster" - D. Waltrip | ----------------------------------------------------------------------------- | All opinions stated above are mine -- who else would want them? | -----------------------------------------------------------------------------