Terminal Program? 
Author Message
 Terminal Program?

Hi all,

    I haven't been able to get a response about this, so I'll try it
here.
I was wondering what is wrong with this code. I am trying to write a
terminal
program, and it gets hung up when I try to search for "CONNECT" in the
receive buffer of the modem...
any ideas?
Later,
Dave :)

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"... I'm ok, how are you.... thanks for asking..."
- Radiohead, "Palo Alto," Airbag / How Am I Driving?

LivEMa|\|ia[
*** alt.games.final-fantasy newbie! ****
*** If you like Final Fantasy, join alt.games.final-fantasy! ***
aka Dave Hetrick

http://www.*-*-*.com/ ~david_jh/
ICQ UIN: 2565558

[ Dterm.bas 3K ]
''ModemTerminal v1.0 by David Hetrick
'this will be hard
''but i'll try it
'public domain software
'free!
''let's clear screen.
cls
print "DTERM v1.0 by David Hetrick"
print "Checking command-line parameters..."
print "Call DTERM without parameters to get syntax."
param$ = COMMAND$
''get commands
''lowercase em
param$ = LCASE$(param$)
''now, check them.
if param$ = "" then gosub extensivehelp
if param$ = "-h" then gosub extensivehelp
if not param$ = "" then gosub corecode
print "undefined error. Sorry." : end

extensivehelp:
print "DTERM v1.0 by David Hetrick"
print "Usage: DTERM filename [-default]"
print "DTERM requires a modem-information file."
print "You need to specify it as the filename parameter."
print "Syntax for the modem information files is as follows:"
print "COM[number]: [baud],[parity],[data],[stop]"
print "where [number] is the COM port number (1-4),"
print "[baud] is the baud rate. You probably won't use baudrates"
print "below 9600, so the rates are: 9600, 19200, 38400, 57600, and 115200."
print "[parity] is a single-letter standing for one of these five:"
print "S (space), O (odd), M (mark), E (even), N (none)."
print "[data] is the number of databits, from 5-8."
print "[stop] is either 1 or 2."
print "Regular Options/Switches:"
print "[-default] uses the default modem info file, MODEM.INF."
print "Initialization string is ATQ0V1E1S0=0 -- generic..."
print "Example:"
print "DTERM dave.inf"
print "would use dave.inf for the modem info.
end

corecode:
''this is the most integral part of my code.
''watch out ppl!
''Major Overhaul: 6/14/98 22:00
''now, let's split up some of the code.
''let's do a little splicing and diceing here.
'we'll check for -default.
check = tally(param$, "-default")
if check = 1 then let param$ = "modem.inf" : goto 23
if check = 0 then goto 23
''We now have the filename.
''Now, get the filename by itself (hopefully!)
''Now let's get rid of everything else and get the
''filename by itself.
''remember, we still have param$ which is the full parameter
''sequence.
''now, we can finally move ahead... this first 3k of code
''was just to check cmdline params!!! can u believe that???
''ok it will be ez now.
23 print "Command-line parameters OK."
let bufferlen = 4000
let initstr$ = "ATQ0V1E1S0=0"
print "From what you entered, setting initstring as ";initstr$
print "and setting buffer length as";bufferlen
print "Using ";param$;" as modem info file."
let file$ = param$
25 print "OK, modem info file set as ";file$
print "Now, getting modem data from ";file$
open file$ for input as #1
input #1, dta$
close #1
print "Modem data retrieved."
print "Opening modemport with modem configuration derived from ";file$
open dta$ as #1 LEN=bufferlen
print "Modemport opened (hopefully, I am still testing!)"
print "The standard dial command is usually ATDT[number], so we'll"
print "use that. Now we need a number to dial."
input "Number to dial, A for autoanswer, or Q to quit?",number$
number$ = LCASE$(number$)
if number$ = "a" then print "Autoanswer mode on." : print #1, "ATA" : input "Press any key to quit when you're ready...",asi$ : print #1, "ATH" : close #1 : end
if number$ = "q" then print "Quitting, and{*filter*} up." : print #1, "ATH" : close #1 : end
print "Dialing ";number$
''forget the initstring!!!
''Now, dial the number.
print #1, "ATDT";number$
''We have connect...
'let us get the buffer and output to the screen.
line input #1, buffr$
27 print "Buffer Output:"
print buffr$
input "Command (Q to quit):",cmd$
if cmd$ = "Q" or cmd$ = "q" then print "Quitting, and{*filter*} up." : print #1, "ATH" : close #1 : end
print #1, cmd$
goto 27



Sat, 09 Dec 2000 03:00:00 GMT  
 Terminal Program?

::major snippage::

Quote:
> print "Dialing ";number$
> ''forget the initstring!!!
> ''Now, dial the number.
> print #1, "ATDT";number$
> ''We have connect...
> 'let us get the buffer and output to the screen.
> line input #1, buffr$
> 27 print "Buffer Output:"
> print buffr$
> input "Command (Q to quit):",cmd$
> if cmd$ = "Q" or cmd$ = "q" then print "Quitting, and{*filter*} up." : print #1, "ATH" : close #1 : end
> print #1, cmd$
> goto 27

There's no apparent place here where you are looking for a result
string.  You've LINE INPUT'd something into buffr$, but that may not be
the entire answer.  Most modems have two response modes: verbose and
numeric.  the Numberis responses are just that; a simple 1 or 2 digit
number followed by a carraige return.  It's up to you as the programmer
to tell if the number means a good connection, no answer, busy, no
dialtone, etc.

With verbose reporting, there may be as much as 5 lines of response,
telling you everything from connect speed to compression level.  You
need to spend more code to pick apart what the modem is sending back.

--
----------------------------------------------------------------

Novell tips at http://www.*-*-*.com/ ~ndurland/novelltips.html
----------------------------------------------------------------
If at first you don't succeed, skydiving isn't for you!
----------------------------------------------------------------



Sun, 10 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Anyone have a qbasic or basica Terminal Program ????

2. Terminal Program Help

3. QB45 Terminal program -HELP!

4. Help with terminal program

5. Terminal programs

6. My Terminal Program...

7. Great terminal program!

8. Qbasic terminal program: need help

9. Terminal Program

10. Small VB4 Terminal-Program with VT100 emutation

11. Creating a Terminal Program

12. terminal program

 

 
Powered by phpBB® Forum Software