TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Gary Chambers
from: Jon Guthrie
date: 1994-12-25 14:32:18
subject: Comm Routines

16 Dec 94, Gary Chambers writes to Jon Guthrie:

 >>> stumped on how I should go about writing to the local screen and the
 >>> comm port simultaneously, and how to get input from remote.

 >> My door library writes everything twice...

 > Thanks, Jon.  I will keep this in mind.

There isn't much you can do BUT write everything twice in that situation.  This
is especially true if you want the local display to be different from the
remote display, which is typical.

 >> Input is really a piece of cake
 >> except for the fact that you have to have some sort of
 >> timeout to recognize ESCapes separate from escape sequences.

 > I am unfamiliar with this.  Can you elaborate, or provide some source
 > snippets?  Thanks again!

If you are writing a program that deals with a remote terminal, you are
likely to have two conflicting requirements.  You probably would like it to
interpret things like the "arrow keys" properly and you probably
would like to interpret single ESCape characters as single ESCape
characters.  The conflict occurs because the "arrows keys" most
likely send sequences that begin with ESCape characters.  So, if you
receive an ESCape, you don't know if it's a single ESCape or the beginning
of one of the sequences triggered by an arrow key.

What I do is put a timeout on each character and check the next character
received to see if it's a '['.  If the call to read the next character
times out or if it isn't a '[' then it's a lone ESCape.  If I get a '['
without timing out, then it may be an "arrow key."  (Then again,
it might not.)

Is any of this clear?

You probably want to use

- Jon

--- GoldED/2 2.42.G0214
* Origin: The Wandering Programmer Comes Home (1:106/2000.25)
SEEN-BY: 12/2442 620/243 624/50 632/348 640/820 690/660 711/409 410 413 430
SEEN-BY: 711/807 808 809 934 942 949 712/353 515 713/888 800/1
@PATH: 30883/25 106/2000 449 116 170/400 270/101 396/1 3615/50 229/2 12/2442
@PATH: 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.