Home All Groups Group Topic Archive Search About

Isn't this possible in C#???

Author
16 Nov 2004 8:52 AM
Ramakant Kasar

Hi All,

I have come across an application that runs in background and records the
communication over the Serial Port.  How it works is, the sample application
needs to be started and mapped to a serial port say COM1.  Then the
applicaiton starts waiting for the data over the configured port and logs
the same on arrival.

When I tried to write the similar application in CSharp I have hit the road
blocks.  Basically, when I try to open a port that is already opened it
throws an exception that the port in use cannot be opened again.

Any ideas about what is the technique adopted by the sample application to
trap the serial port communication?

Thanks in advance,

Regards

Ramakant K.
Author
16 Nov 2004 12:23 PM
Patrik Löwendahl [C# MVP]
I'm just guessing here, but WMI is used to monitor a lot of things. Maybe
they're using this for monitoring COM ports as well?
--
Patrik Löwendahl [C# MVP]
www.cshrp.net - "Elegant code by witty programmers"
Show quoteHide quote
"Ramakant Kasar" <ramakant_kasar_NOSPAM@systime.co.in> wrote in message
news:OFVB7j7yEHA.2196@TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> I have come across an application that runs in background and records the
> communication over the Serial Port.  How it works is, the sample
> application
> needs to be started and mapped to a serial port say COM1.  Then the
> applicaiton starts waiting for the data over the configured port and logs
> the same on arrival.
>
> When I tried to write the similar application in CSharp I have hit the
> road
> blocks.  Basically, when I try to open a port that is already opened it
> throws an exception that the port in use cannot be opened again.
>
> Any ideas about what is the technique adopted by the sample application to
> trap the serial port communication?
>
> Thanks in advance,
>
> Regards
>
> Ramakant K.
>
>
Are all your drivers up to date? click for free checkup

Author
16 Nov 2004 12:57 PM
Patrice
IMO you can't do that by opening the port again as this is an exclusive
resource.

It would be more something like using a driver allowing then to hook into
the port activity. Don't the sample application installs a driver ?

Patrice

--

Show quoteHide quote
"Ramakant Kasar" <ramakant_kasar_NOSPAM@systime.co.in> a écrit dans le
message de news:OFVB7j7yEHA.2196@TK2MSFTNGP14.phx.gbl...
> Hi All,
>
> I have come across an application that runs in background and records the
> communication over the Serial Port.  How it works is, the sample
application
> needs to be started and mapped to a serial port say COM1.  Then the
> applicaiton starts waiting for the data over the configured port and logs
> the same on arrival.
>
> When I tried to write the similar application in CSharp I have hit the
road
> blocks.  Basically, when I try to open a port that is already opened it
> throws an exception that the port in use cannot be opened again.
>
> Any ideas about what is the technique adopted by the sample application to
> trap the serial port communication?
>
> Thanks in advance,
>
> Regards
>
> Ramakant K.
>
>
Author
16 Nov 2004 1:46 PM
jamie
> When I tried to write the similar application in CSharp I have hit the road
> blocks.  Basically, when I try to open a port that is already opened it
> throws an exception that the port in use cannot be opened again.
>

This is a lower level problem... this needs to be done at the driver
level (C/C++ only).  Also, there is no language that will let you open a
serial port twice.

Jamie

Bookmark and Share