🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #10602

Re: rs232 under XP

#10602
From: Benjamin Pratt
Date: Tue, 30 Mar 2004 18:57
18 lines
1921 bytes
> I can create a handle for the COMport with CreateFile but if I use the
> handle in WriteFile or SetCommMask the program hangs up.
> This happens only, when in the Thread WaitCommEvent is used. I found out,
> that the whole program concerning the handle for the comport hangs there.
If
> something should be sent (but does not) and then a character is received,
> both is done together and then everything hangs again at WaitCommEvent
until
> the next character is received

WaitCommEvent will do exactly that unless the port was opened with
FILE_FLAG_OVERLAPPED. Otherwise WaitCommEvent enters an efficient wait state
and blocks until one of the specified events occurs.

You can either put this processing in a worker thread so the application
thread can continue to process messages, etc. or you can use OVERLAPPED_IO.
However, even with OVERLAPPED_IO it often makes sense to put the serial i/o
in a thread or threads (one for input, one for output).
Technical Details
Message-ID: <4069c1f9$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed.mesh.ad.jp!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40693a3f@newsgroups.borland.com> <4069a26a@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,8913094e963c267d
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-30 11:02:55 PST
From: "Benjamin Pratt" <benjamin.pratt.getridofthis@verizon.net>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <40693a3f@newsgroups.borland.com> <4069a26a@newsgroups.borland.com>
Subject: Re: rs232 under XP
Date: Tue, 30 Mar 2004 10:57:42 -0800
Lines: 20
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 24.130.93.201
Message-ID: <4069c1f9$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1080672761 24.130.93.201 (30 Mar 2004 10:52:41 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed.mesh.ad.jp!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail