×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Programming a RJ45 Serial Port in Windows XP

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

RE: Programming a RJ45 Serial Port in Windows XP

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.

RE: Programming a RJ45 Serial Port in Windows XP

(OP)
My mistake... I meant RS232. Thank you so much. Things are working better now;)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources