Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programming a RJ45 Serial Port in Windows XP 1

Status
Not open for further replies.

SameenR

Computer
May 4, 2005
2
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
 
Replies continue below

Recommended for you

RJ45 serial? I thought RJ45 was ethernet. Anyway whatever it is, it doesn't really matter.

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.
 
My mistake... I meant RS232. Thank you so much. Things are working better now;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor