[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Character flow



On Thu, 20 Nov 1997, Roman Shterenzon wrote:

> Hi!
> 
> Does anyone know how it's possible to monitor the data flow via
> character devices?

In some unices you can I_PUSH yourself to the device when opening it but
since you probably want to monitor something without modifying it, the
easiest way is to connect the application to a certain tty (other than the
one it usually connects) and write a very simple script that connects its
pty to the right tty while also saving the data in both directions to a
file.  If the application insists on opening a tty by a certain name, just
replace it with a pty temporarily.

example: you want to monitor /dev/modem traffic.  you do the following:

mv /dev/modem /dev/modem.orig
ln -s /dev/ttypf /dev/modem
(now run a simple program that opens /dev/ptypf and /dev/modem.orig, and
transfer data between them while also logging it)
run your application and see the results.
rm /dev/modem
mv /dev/modem.orig /dev/modem

thats it.

btw, if what you want to monitor is a standard terminal, use an application
called "pty" instead if writing one yourself.    it does the transfering
and logging.

> -- 
> 
> --Roman Shterenzon
> 
> ----------------------------------------------------------
> E-Mail:  romance@NetVision.net.il      Tel: +972-4-8576141
> Home Page:                         http://mapc.home.ml.org
>           http://www.geocities.com/SunsetStrip/Towers/4549
> ----------------------------------------------------------
>