COM-port for multiple applications
-
Hi All ! Does anyone know the way to share one COM-port for a few applications ? I know that OS gives only one handle for COM-port for all applications, but may be exist some sharing method ?
-
Hi All ! Does anyone know the way to share one COM-port for a few applications ? I know that OS gives only one handle for COM-port for all applications, but may be exist some sharing method ?
I do not know what you are trying to do? Are you writing all the applications that needed to share the COM-port? If so, then only open the port when you needed to use it and close it when done. This should allow any other application on your system to use it when you are not. If you want to share it with other application out side of your control. Sorry, if they keep it open continuiously then there is nothing you can do but close that application. Trust in the code Luke. Yea right!
-
Hi All ! Does anyone know the way to share one COM-port for a few applications ? I know that OS gives only one handle for COM-port for all applications, but may be exist some sharing method ?
You make no sense. Which of the XX ports sharing the port should control the hardware lines? Any? All? What you might want is a proxy, one app to take commands from mulitple sources, queue them, and spit them out. When stuff comes in, who then gets it? the next person to call read, or all of them?
-
Hi All ! Does anyone know the way to share one COM-port for a few applications ? I know that OS gives only one handle for COM-port for all applications, but may be exist some sharing method ?
By nature the comm ports are asyncronous. "sharing" them is not feasible as it makes logical sence that only one program at a time would be reading / writing data via a comm port. Simply open them when you have data you wish to read from or write to the port and close it as soon as you are done. Some applications are arrogant enough to think that they have permenant control of hardware resources such as the comm ports. Palm "Hotsync" is one that comes to mind, opening the comm port and holding it open the entire time it runs. The solution to someone needing to share the comm port is to close these errant apps and only allow them control of the port when their device is read to communicate via the comm port. I guess that last sentence really says it all. By nature you need to know when "your data" is coming down the async stream and read it. The rest of the time you care less what data is coming in. The same goes for outbound data. On the other hand if you truly wish to "share" the data coming in via the comm port then write a single program that reads and records the data to a fifo file and use that file as input to the various applications that are all wanting to read the same data. You cannot share the port for output since that would mean a garbled data stream going out.