From: Michaela Brauner on
Hello,

I'm looking for a easy and good class for serial port.

a) synchron
b) asynchron

Where can I find it?

Example for synchron
Send char's' + char(13) to trigger a scanner (DM code)

The scanner send the feedback as char(2), Content, char(3)

Example for asynchron
The scanner send the the result as char(2), Content, char(3)


How is the best way to do that?


Thanks.


Greeting Michaela
From: Goran on
On Jun 6, 9:48 pm, Michaela Brauner <m...(a)MNEWS.de> wrote:
> Hello,
>
> I'm looking for a easy and good class for serial port.
>
> a) synchron
> b) asynchron
>
> Where can I find it?

Will this work:

http://www.google.com/search?q=CSerialPort
From: Joseph M. Newcomer on
It is generally difficult-to-impossible to use synchronous I/O on a serial port. Consider
the sequence
ReadFile(...); // wait for some device to transmit data
WriteFile(...); // poll a device for its status

In synchronous mode, the WriterFile cannot be executed unless some device has completed
the ReadFile. So if you want to run a full-duplex device like a serial port, you MUST
open in for asynchronous I/O. Forget you ever heard of synchronous I/O to program a
serial port; it won't work.

What I do is something I call "pseudo-synchronous I/O". The idea is that I open an
asynchronous handle, do a ReadFile, and wait for the completion of the I/O. Then I can
still do WriteFile operations. I typically use a UI thread to do WriteFile (so I can
PostThreadMessage to it to send things) and a worker thread for ReadFile (and it will
PostMessage to my main thread when data arrives)

You can see a sketch of my typical serial port handling on my MVP Tips site:

http://www.flounder.com/serial.htm
joe


On Sun, 06 Jun 2010 21:48:07 +0200, Michaela Brauner <m_B(a)MNEWS.de> wrote:

>Hello,
>
>I'm looking for a easy and good class for serial port.
>
>a) synchron
>b) asynchron
>
>Where can I find it?
>
>Example for synchron
> Send char's' + char(13) to trigger a scanner (DM code)
>
> The scanner send the feedback as char(2), Content, char(3)
>
>Example for asynchron
> The scanner send the the result as char(2), Content, char(3)
>
>
>How is the best way to do that?
>
>
>Thanks.
>
>
>Greeting Michaela
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Michaela Brauner on

Hello,

>>
>> a) synchron
>> b) asynchron
>>
>> Where can I find it?
>
> Will this work:
>
> http://www.google.com/search?q=CSerialPort
http://www.bing.com/search?q=CSerialPort+C%2B%2B+synchron++asynchron&go=&form=QBLH&filt=all
of course, but here I haven't informations is good or bad.

Maybe you have good class for this.

- Michaela -