TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mads Orbesen Troest
from: Herbert Rosenau
date: 1998-12-08 17:28:10
subject: Peeking at COM data?

Hi Mads,

 you wrote at 28.11.98  02:53 to All :
 
 MOT> I have a somewhat banal problem that nevertheless continues to
 MOT> bug me: how do I /peek/ data from the COM port? I have opened
 MOT> the port using DosOpen, defined its characteristics via IOCTL
 MOT> and can read from it without problems using DosRead; I have a
 MOT> situation, however, in which I'd like a peek at the data without
 MOT> actually removing it from the buffer. How to do that, I wonder?

Do it by your own:

1. create a separate thread to communicate with the port.
2. make a (simple internal protocol to communicate (and exchange data)
between your mainthread and the port thread. Or oranise the buffer to your
need (e.g. ring or double buffer) Make your own local APIs to handle this
simple from your worthread. E.g.:

OpenPort()	- starts the thread and initialises the buffers
ReadPort()	- reads from buffer
PeekPort()	- reads without freeing the buffer
GetState()	- status of port/buffer(s)
WaitPort()	- wait until data received (wraps a semaphore or PM message)
........



Tschau/Bye

Herbert


--- Sqed/32 1.14/development  23:
* Origin: DOOM - Killing For Workgroups (2:2476/493)
SEEN-BY: 396/1 632/0 371 633/260 267 270 371 635/444 506 728 639/252 670/218
@PATH: 2476/493 480 2410/200 2432/200 2433/1200 225 270/101 396/1 633/260
@PATH: 635/506 728 633/267

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™.