BBS: Inland Empire Archive Date: 03-21-92 (16:47) Number: 82 From: KEVIN NEWELL Refer#: NONE To: MIKE CLARK Recvd: NO Subj: Re: Modem state checking Conf: (2) Quik_Bas
Hello Mike! In a msg of <20 Mar 92>, Mike Clark writes to All: MC> I have overcome the exiting a QB program without ending MC> communications. I must apologize to Kevin Newell to whom I told his MC> example didn't work, which it did. Sorry Kevin!! I am now asking for MC> for a little help in another area. It is checking the modem to see if MC> it is still connected or if it lost carrier. If anyone has any ideas MC> on how to do this please let me know! The only way that my friend and MC> I tried was to keep putting together a string then to check if it said MC> "No Carrier", but there has to be a easier and more effient was. MC> Mike Clark MC> P.S. has anyone ever heard of a program called File Filer, I just MC> finished one and called it that and I wanted to know if that name is MC> already out there! I hope not, I sent the Copyright forms Yesterday!! Mike, The way I do it is a little complicated, but I will explain it, and if you don't understand it, I can let you have a program that I wrote and look it over. It is not documented so it might look like spaghetti to you... First of all I use alot of error handling. After the com port is opened (if it is opened) I set a variable to -1. Then before I write to the comport, I check to variable to see if the modem is online or offline. If online, I go ahead and write to the comport, else I don't. I let QB handle the carrier loss, if I get an error on writing or reading the comport, I check the error in my error handling routine, and if the error is loss of carrier then I exit the program. ON ERROR GOTO HANDLE BAUDRATE% = 300 OPEN "COM1:300" FOR RANDOM AS 1 IF BAUDRATE% THEN PRINT #1 "IT WORKS!" ELSE PRINT "COM PORT IS NOT OPENED" END IF DONE END HANDLE: X=ERR IF ERR = 24 THEN BAUDRATE% = 0 RESUME NEXT ELSE PRINT "ERROR ";X;" RETURNING TO BBS" RESUME DONE END IF END: Shortly, this is how I do it... Chat Later! Kevin --- GoldED 2.31p * Origin: --> Treasure Island {309} 346-2074 @14.4 *HST/V42b* (1:232/200)
Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET