Xref: utzoo comp.sys.mac.programmer:3604 comp.sys.mac:24233 Path: utzoo!attcan!uunet!husc6!bloom-beacon!apple!parent From: parent@Apple.COM (Sean Parent) Newsgroups: comp.sys.mac.programmer,comp.sys.mac Subject: Re: RAMSDOpen Summary: lock up on serial write Keywords: mac, serial, port, ramsdopen, open, help Message-ID: <22587@apple.Apple.COM> Date: 20 Dec 88 18:32:08 GMT References: <2094@uokmax.UUCP> Distribution: na Organization: Apple Computer Inc., Cupertino, CA Lines: 21 In article <2094@uokmax.UUCP>, srpenndo@uokmax.UUCP (Sean Richard Penndorf) writes: > If I use RAMSDOpen to open the serial port for use with a modem, AND > no carrier is currently connected, as soon as I make a FSWrite call to the > serial port, the program locks up and I have to re-boot. However, if I make > an Open Driver call to open both the output and input ROM drivers, the > program works fine, with no other changes. I think that what is happening is that the driver is using flow control and the modem is not currently recieving. The solution is to make the Write ASYNC and either use a completion routine to notify you when the send is complete or monitor the ioResult in the ParamBlock (you must use PBWrite). ioResult will stay positive until the write is complete and then it will either go to 0 (no error) or negative (error code). Monitoring ioResult can be a bit simpler then writing an ioCompletion routine. It might be a good idea to time out your write after about 30 seconds (adjust it to the size of the block you are send- ing). You can cancel the write with a call to PBKillIO. Keep in mind that during the write the ParamBlock and the ioBuffer are in-use and cannot be reused without disasterous results. (Make sure you don't dealocate them during a write). Sean