PDA

View Full Version : Win32 Programming Question



Johnstown
December 14th, 2006, 12:29 PM
We have this old, in-house, utility for listening to two serial ports. The program has some brains where it'll be able to identify various types of packets coming across the wire. The program is a passive listener, and usually involves this box we made called a Sniffer. We use this to provide timestamped logs of data between a radio and its control head, or between devices in our console system. The Sniffer does level conversions between TTL, RS-232, and RS-422 signal levels, so the PC serial ports can hear it.

Anyway, this program was written years ago, it only listens to two serial ports, and it polls them and the console for data. I'm planning on rewriting it on my own time to be a bit more modern. My coding expierence under embedded environments and with Linux/UNIX systems. (Heavy on the embedded. I develop using the GNU tool chain cross-compiling for the embedded processor we use with an RTOS that is very Unix-like.)

I know how to get a Linux app to listen to multiple serial ports using my select()-fu. Is there a command as simple as select() under Win32? All I want to do is fopen() the serial ports I want, and just select() them all. (And this is just a simple command-line driven tool. That's all it needs to be.) My goal is just one set of source with a compile time option to select the target OS.

Zayin
December 15th, 2006, 09:09 AM
This might help if your using the .NET Compact Framework (which is included with CE, assuming that's your target).

http://msdn.microsoft.com/library/defau ... _netcf.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/serial_com_netcf.asp)