Computer: Programming
Cross-looped port driver   (+1, -1)  [vote for, against]
Create two 'virtual' COM: ports that talk to each other

As a software developer, I often have to develop code which communicates via serial port. In many cases one side of the protocol will be a PC and the other side an embedded device; during development of the PC side, however, it's often useful to write or used a PC-based "simulator" of the embedded device. Unfortunately, having the simulator and main program talk to each other often requires either running them on different machines or running a null modem cable from COM1: to COM2: and having the two programs communicate through that.

What I would like to see would be a virtual device driver which would create two COM: ports (e.g. COM7 and COM8). Any time only one port was open it would act as a black hole (data going in is tossed, and no data comes out), but when both ports were open any data sent out one port would appear at the other.

Such a driver should be fairly simple, but would increase the usefulness of many PC-based simulators immensely.

[nb: while Linux might be able to do this without drivers, many aps and simulators run under Dos or Windows].
-- supercat, Feb 27 2002

Google search... (129,000 hits) http://www.google.c...&btnG=Google+Search
for +virtual +serial +port +Windows [phoenix, Feb 27 2002, last modified Oct 05 2004]

The very first result returned from the above search http://www.lvr.com/serport.htm
"Virtual Serial Ports Driver creates two software-only serial ports that are virtually connected to each other. All data sent by other application to one of the ports will arrive at the other port. For use as a debugging tool or a way to create a data channel between two Windows applications. For Windows 9x/Me. From Vitaliy Golubenko." [phoenix, Feb 27 2002, last modified Oct 05 2004]

Hawk's link http://www.alarit.c...oducts&subpg=p_afsd
Grrrr.. [yamahito, Aug 13 2002, last modified Oct 05 2004]

// Where does all of the missing data go?//

Try sending data out a serial port with nothing connected (handshaking turned off) and follow it. You'll probably find it goes to the same place as the data would in a cross-port driver.
-- supercat, Feb 27 2002


[obligatory "this is baked in unix, and called a pty or pseudo-terminal" post]
-- wiml, Feb 27 2002


wiml: Do pty's support modem-control lines and realistic flow constrictions? Although I didn't explicitly mention it, one feature I would like in a cross-looped port driver would be the ability to set "baud rate" and "modem-control wires" and have the port mimic real-time interactions between both ends.
-- supercat, Feb 27 2002


Using two machines isn't impossible, but it can often be a nuisance. Using one machine is often much more convenient.
-- supercat, Feb 27 2002


I see phoenix found something. I was wondering about the Microsoft Driver Development Kit, which has lots of support for debugging serial port applications, as well as other types of driver. But after wading through page after page of Microsoft's horrible websites, I gave up looking.
-- pottedstu, Feb 27 2002


Isn't it amazing how a company like Microsoft can't maintain a decent web site? What's even more amazing is that contradictory information can often be found at various locations.
-- phoenix, Feb 27 2002


phoenix: Thanks for the link. I was at a loss for how to be specific enough in a request to get something useful out of Google (since finding something good out of 10K+ matches is usually nearly impossible). Your query, though it produced over 100K matches, happened to have what I was looking for in the first link. Go figure.
-- supercat, Feb 27 2002


supercat: yes, the point of a pty is to imitate an attached terminal, so it appears to be a serial port, with modem control lines, baud rate, etc. etc. (It doesn't actually limit the rate of transmission to the baud rate, but it supplies enough stuff that the 'master' can do that itself, if it wants to.) If you didn't need all the imitation modem control lines and so forth, you would just use a pipe or a socketpair.
-- wiml, Mar 01 2002


Just found another very good virtual serial driver solution - demo is only 30 kb and has full functionality to test. Looks like I've found what I was looking for. I can share it with you - http://www.alarit.com/index.php?pg=products&subpg=p_afsd
-- hawk, Aug 13 2002


Hawk, there's a link button at the top.
-- yamahito, Aug 13 2002



random, halfbakery