-5

Language: C++ IDE: Microsoft Visual Studio 2010

Hardware setup: Machine[rs232]---> [rs232 to usb] ---> [usb]Computer

Data being sent: Result information as ascii text.

I am trying to access the ascii data that is coming in from the machine's rs232 port into the computer's usb port.

How do I open the connection and start listening for this data?

I have some experience with network programming, which was as simple as listening on the correct port# for packets from the server. But, I'm unsure what to do to listen for data coming in on usb or from rs232 for that matter... Very new to receiving data in this fashion.

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
cazicss
  • 25
  • 3
  • 1
    That's why you're hindered to ask _"How To"_ questions in 1st place from the editor! Just trying to come over with `"`syntactical trickery `"` doesn't help. Such questions lead up being too broad! – πάντα ῥεῖ Jul 02 '14 at 00:34
  • It shouldn't be a large answer to open a connection and listen in c++ – cazicss Jul 02 '14 at 00:36
  • I simply don't know how to start up the listening as I do with winsockets. This form of network programming feels less documented. – cazicss Jul 02 '14 at 00:38
  • _'It shouldn't be a large answer'_ If you think so, and you're sure you know it, it's perfectly OK to answer yourself. Otherwise think twice about all of the pitfalls and obstacles you might run into. That's a broad topic of course, no doubts! So what have you tried, and which particular problems did you experience? If you can't tell about that, read the documentation of your API 1st before asking here. – πάντα ῥεῖ Jul 02 '14 at 00:39
  • 1
    _'This form of network programming feels less documented.'_ [**seriously?!?**?](http://stackoverflow.com/questions/2399377/examples-for-winsock) At least nothing less, than the usual crappy< microsoft documentation. – πάντα ῥεῖ Jul 02 '14 at 00:51
  • What you're looking for is reading from a serial port. It may be as simple as opening `COM1` (as a file) for input. – Wyzard Jul 02 '14 at 00:57
  • @cazicss _'I have some experience with network programming'_ Which kind of? I think you would miserably fail on an apprentice test I'd do with you :-S ... – πάντα ῥεῖ Jul 02 '14 at 01:07

1 Answers1

0

The CreateFile and ReadFile APIs are used to open and read a serial port (even if it comes from USB). See the MSDN article titled "Serial Communications in Win32"

ScottMcP-MVP
  • 10,337
  • 2
  • 15
  • 15
  • Thank you for your response =].. I'm currently reading the page you suggested. Fingers crossed with hope that I can get something going soon. – cazicss Jul 02 '14 at 01:34