🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: WriteFile problems (help me!)

#16017
From: Cerny
Date: Wed, 04 Jun 2003 08:10
35 lines
2329 bytes
Hi,

I have experienced the same problem under W98: synchronous WriteFile()
on serial port hangs.

The program is multithreaded, one thread does the serial
communication. I use synchronous ReadFile/WriteFile, set correctly
DCB/SetCommState and timeouts, check return values etc.etc. Under
W2k/WXP performs without problems. Under Win98, after some time
(usualy about 5-8 hours, but sometimes right after 10 minutes) a call
to WriteFile hangs - simply does not return. Other threads go on
normally.
I have tried it many times on many different machines.

Details:
DCB: 9600,8,n,1 (but 2400 hangs too), .fOutxCtsFlow=0,
.fOutxDsrFlow=0, .fOutX=0, .fInX=0, .fAbortOnError=0 etc. (no
handshaking used),
CommTimeouts: ReadIntervalTimeout=10, ReadTotalTimeoutConstant=200,
ReadTotalTimeoutMultiplier=10, WriteTotalTimeoutConstant=200,
WriteTotalTimeoutMultiplier=10),
CreateFile and SetCommState is called only once (at startup),
no call (CreateFile/SetCommState/SetCommTimeouts/ReadFile/WriteFile
etc.) returns any error (I am checking the return value all the time),
output messages are 5 to 255 B long, 
input messages are 5 to 40 B,
communication is master-slave (computer writes message and the
attached device answers),
there are 3-4 WriteFile calls every second,
I empty input buffer before WriteFile (even it is usually empty as the
communication is master-slave).

The only workaround I have found is to use Win2k or XP.

Knows anybody something better?
Technical Details
Message-ID: <22a38d28.0306040010.27defce@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
References: <3ec25f43$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9ac30f5163521f9f
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-04 01:10:26 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: cerny77@centrum.cz (Cerny)
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: WriteFile problems (help me!)
Date: 4 Jun 2003 01:10:25 -0700
Organization: http://groups.google.com/
Lines: 35
Message-ID: <22a38d28.0306040010.27defce@posting.google.com>
References: <3ec25f43$1@newsgroups.borland.com>
NNTP-Posting-Host: 195.250.147.12
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1054714225 31343 127.0.0.1 (4 Jun 2003 08:10:25 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 4 Jun 2003 08:10:25 GMT