Click here to Skip to main content
15,908,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to read data from com3 port which is opened by another application. How can i get it? is there anyway to do, just i want to read data using c#

Anybody can help me
Posted

You can't. Once the port is open, the remote application has acquired a exclusive lock on the port and no-one else can use it. There are good reasons for this: a port is not the same kind of animal as a file - you can't rewind it and look at the data again. So if two devices could access the port, then neither could guarantee to get all of the bytes received.

If you want to do this, and it is a genuine serial port, then you could look at physically connecting the receive data pin to two different ports and connecting your application to teh new one. Most serial ports will cope with the added load of one port without problems, but may get iffy when loaded with more than one.
 
Share this answer
 
Comments
sujithmtla 8-Oct-13 5:48am    
K thank you, I have connected bio metric device in that port, Is it possible to fetch Id from bio metric device when user punch their finger? Just i want to fetch ID itself
OriginalGriff 8-Oct-13 6:30am    
Not directly from the device, no - it doesn't store ID's it just reads data and transfers it to the application - which looks up the biometrics in it's database and detects the user.

What you need to do it look at the manufacturer of the device and use their API to be notified of a user detection. You shouldn't have to go near the "raw" data at all - if only because it won't mean anything to you without the database and algorithm the application is using!
sujithmtla 8-Oct-13 9:24am    
Ya i understood what you are telling, is it possible to read data from bio metric device by port reading using c#? Will it work? can you give some input for that

Thanks for your comments
OriginalGriff 8-Oct-13 9:33am    
You probably could - but it would almost certainly need you to disable the manufacturers drivers, which will be installed by Plug'n'Play so that may not be that simple.

Why not talk to the device manufacturers? They will have a much better idea than we will!
1) Change the other application so it informs your program of what it read.
or 2) Change your program so it opens COM3 and informs the other application of what it read.
or 3) Solder a Y-cable so two COM ports read identical data. Don't connect RX so your program doesn't interfere, just listen.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900