Programming a RJ45 Serial Port in Windows XP
Programming a RJ45 Serial Port in Windows XP
(OP)
I am modifying existing code for a program which exchanges data via an rj45 serial port. The original code was written in the 90s, on Visual C++ 6.0, and is compatible with windows 98/2000. I am trying to make it compatible with Windows XP.
My questions are:
1. Is Visual C++ 6.0 a good compiler for this kind of programming?
2. What can be done to get around the fact that XP doesnt allow you to access the serial port directly? What approach can I take to communicate with the serial port in XP?
Sameen Rehman
My questions are:
1. Is Visual C++ 6.0 a good compiler for this kind of programming?
2. What can be done to get around the fact that XP doesnt allow you to access the serial port directly? What approach can I take to communicate with the serial port in XP?
Sameen Rehman





RE: Programming a RJ45 Serial Port in Windows XP
If it is one of the COM or LPT ports, you can use
OpenFile to open the port
BuildDCB etc to configure the baudrate
ReadFile to read
WriteFile to write
CloseHandle to close. Somehow they left out CloseFile.
If it is one of USBs or a specialized card, you'll have to find out what name windows has given the serial port. For better performance, look up Overlapped I/O. It is basically a callback mechanism.
I've used Visual 6 for everything from 95 to XP and it works as long as you're not trying to do .net stuff. It isn't a very good C++ compiler if you're a purist. I'm not that bothered about standards: I just like to get the code working so that doesn't really bother me.
RE: Programming a RJ45 Serial Port in Windows XP