Re: Quirk reading comm port
From: Andrew Jarvis (someone_at_somewhere)
Date: 11/22/04
- Next message: V.V.Gatt_at_nospam.com: "Re: Boot drivers namespace"
- Previous message: Nadav: "Re: Process creation interception"
- In reply to: valentin tihomirov: "Re: Quirk reading comm port"
- Next in thread: Alexander Grigoriev: "Re: Quirk reading comm port"
- Reply: Alexander Grigoriev: "Re: Quirk reading comm port"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Nov 2004 09:45:41 -0000
Dear Valentin,
Many thanks for replying but you ought to learn to read a program before you
criticise it.
The "buffer" that I am filling with zeroes is actually a structure used for
overlapped I/O operations. I'm not exactly sure what you mean by "string
operations on memory is bottleneck" but its hardly relevant in this
instance.
You wrote "As Windows is not a realtime system, you cannot be sure that your
message will be received during specific time."
I am not concerned about time taken. My problem is that although the data is
received and ReadFile sets the overlap event, the call to
GetOverlappedResult returns zero as the number of bytes read. (I realise now
that I did not make this clear in my post).
I fixed a bug somewhere else in the program and this problem has now gone
away but there is still no reason why it should happen.
Consider keeping your posts polite in future.
Matt 7:3 "And why do you look at the speck in your brother's eye, but do not
consider the plank in your own eye?"
Yours sincerely,
Andrew Jarvis
"valentin tihomirov" <spam@abelectron.com> wrote in message
news:308808F2tr2e5U1@uni-berlin.de...
> Excuse me, I think your system sux. You fill a buffer with zeroes (string
> operations on memory is bottleneck of PC) while this is your device which
> must send asciiz. Observing the 0 you'll make sure that string is received
> completely. As Windows is not a realtime system, you cannot be sure that
> your message will be received during specific time, only byte order is
> guaranteed.
>
----- Original Message -----
From: "Andrew Jarvis" <someone@somewhere>
Newsgroups: microsoft.public.win32.programmer.kernel
Sent: Tuesday, November 16, 2004 4:35 PM
Subject: Quirk reading comm port
> Dear All,
>
> The code is intended to provide a read with timeout of a number of
> characters from a serial port which is does the majority of the time.
>
> Occassionally the call to GetOverlappedResult returns 0 even though it
> should not be reached unless the ReadFile has completed successfully.
>
> Any suggestions?
>
> Yours,
> AJ
>
>
> OVERLAPPED readOverlap;
>
> ZeroMemory(&readOverlap, sizeof readOverlap);
>
> readOverlap.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
>
> ReadFile(hCom, buffer, bytesToRead, NULL, &readOverlap);
>
> if (WaitForSingleObject(readOverlap.hEvent, timeout) == WAIT_OBJECT_0)
> {
> GetOverlappedResult(hCom, &readOverlap, &bytesRead, FALSE);
> .
> .
> .
> }
> else
> PurgeComm(hCom, PURGE_RXABORT);
- Next message: V.V.Gatt_at_nospam.com: "Re: Boot drivers namespace"
- Previous message: Nadav: "Re: Process creation interception"
- In reply to: valentin tihomirov: "Re: Quirk reading comm port"
- Next in thread: Alexander Grigoriev: "Re: Quirk reading comm port"
- Reply: Alexander Grigoriev: "Re: Quirk reading comm port"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|