I have a vague memory of seeing this - if I remember correctly, the answer was
to call SerSendWait before the SerClose:
SerSendWait(SerialRefNum, -1);
SerClose(SerialRefNum);
- Al -
On Thu, 30 Mar 2000 12:40:25 -0500, you wrote:
>To all interested:
>
>Regarding the specifics of my SerClose problem
>(it hangs if using hardware handshake and
>nothing is plugged into the port). I've stripped
>things down, and the code snippet below
>displays the problem ... it's essentially pulled
>straight from the online documentation. Note
>that no errors are ever returned (my actual
>code tests 'em).
>
>// demonstration of my SerClose problem ....
>
>Err e;
>SerSettingsType sstSetup;
>extern UInt SerialRefNum;
>
>e= SerOpen(SerialRefNum,0,9600);
>e= SerGetSettings(SerialRefNum, &sstSetup );
>
>sstSetup.baudRate= 9600;
>sstSetup.flags= serSettingsFlagBitsPerChar8 |
> serSettingsFlagStopBits1 |
> serSettingsFlagRTSAutoM |
> serSettingsFlagCTSAutoM;
>
>// NOTE: if the RTS and CTS flags are not ored in,
>// then there is no problem with SerClose
>
>sstSetup.ctsTimeout = (SysTicksPerSecond() / 2);
>
>e = SerSetSettings (SerialRefNum, &sstSetup);
>SerReceiveFlush (SerialRefNum, 100);
>
>// write something
>
>char buffer[]= "yippee, it works!";
>ULong bytesWritten= SerSend
>(SerialRefNum,(VoidPtr)buffer,StrLen(buffer),&e);
>SerReceiveFlush (SerialRefNum, 100);
>
>// changing settings here to have no hardware handshake
>// won't work since SerSetSettings appears to hang then!
>
>e = SerClose(SerialRefNum); // HANGS ME OUT TO DRY!
>
>// alert never shows if something isn't plugged into the
>// port ... plug something in and "pop" the alert comes
>// up.
>
>FrmCustomAlert(JustAnAlert,"","","");
>
>
>Many thanks in advance to the kind soul who can crack this one.
>Folks in the field are bumming since they have to reset if they
>push the 'print' button when no printer is attached!
>
>[EMAIL PROTECTED]
--
-- Alan Weiner -- [EMAIL PROTECTED] -- http://www.ajw.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html