[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Single byte read of Serial port translated to multiple byte read by framework, which results in I/O Timeout

Del Fredricks

9/19/2008 6:53:00 PM

Application invokes Read(Char[], Int. Int) method for a serial port to read
a single port. Framework appears to first do a GetCommStatus() call to the
serial port driver to see if data is available. If data is present, then a
single byte Read call is made to the serial driver and everything is fine.

However, if GetCommStatus() returns with no data being available, then the
Framework makes a multiple byte (observed to mostly be for 2 bytes, but
sometimes for 3) Read call to the serial driver which eventually results in
a request timeout since the device connected to the serial port only sends a
single byte (as the application was expecting).

Observed behavior is that between the GetCommStatus() and Read call to the
serial driver, the desired byte arrives so that when the Read request comes
down to the driver it is immediately moved into the return buffer for the
request, but the request gets pended until it times out because the
Framework issued the request for multiple bytes instead of the single byte
which the application requested.

Why does the Framework change the Read request sent to the serial driver
from being the single byte request made by the application into a multiple
byte one when the GetCommStatus() call returns with a data count of zero (0)
for the incoming data?


1 Answer

Naked Gonad

11/24/2008 12:52:00 PM

0

Eli Grubman wrote:
> On Mon, 24 Nov 2008 11:56:11 +0000, Naked Gonad
> <bodron57@tiscali.co.uk> wrote:
>
>> Eli Grubman wrote:
>>> On Mon, 24 Nov 2008 11:25:53 +0000, Naked Gonad
>>> <bodron57@tiscali.co.uk> wrote:
>>>
>>>> Eli Grubman wrote:
>>>>> On Mon, 24 Nov 2008 09:19:04 +0000, Naked Gonad
>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>
>>>>>> Eli Grubman wrote:
>>>>>>> On Tue, 18 Nov 2008 09:38:06 +0000, Naked Gonad
>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>
>>>>>>>> Eli Grubman wrote:
>>>>>>>>> On Mon, 17 Nov 2008 18:43:24 +0000, Naked Gonad
>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>
>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>> On Mon, 17 Nov 2008 17:14:03 +0000, Naked Gonad
>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>> On Mon, 17 Nov 2008 16:18:51 +0000, Naked Gonad
>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 15:24:06 +0000, Naked Gonad
>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 14:30:18 +0000, Naked Gonad
>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 13:48:22 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 11:58:37 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 11:34:35 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>>>> On Mon, 17 Nov 2008 09:43:44 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>> On Sun, 16 Nov 2008 19:17:03 +0000, Naked Gonad
>>>>>>>>>>>>>>>>>>>>>>>>>>> <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>> Eli Grubman wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Sun, 16 Nov 2008 18:39:24 -0000, "Peter Hucker" <none@spam.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Sat, 15 Nov 2008 20:04:12 -0000, Naked Gonad <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Peter Hucker wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Fri, 14 Nov 2008 23:28:25 -0000, Eli Grubman <eli.grubman@googlemail.com> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Fri, 14 Nov 2008 18:33:50 -0000, "Peter Hucker" <none@spam.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Thu, 13 Nov 2008 04:15:28 -0000, Eli Grubman <eli.grubman@googlemail.com> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Wed, 12 Nov 2008 18:53:55 -0000, "Peter Hucker" <none@spam.com>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> On Tue, 11 Nov 2008 19:33:48 -0000, Naked Gonad <bodron57@tiscali.co.uk> wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Peter Hucker wrote:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Nought is accepted as meaning nothing generally.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> In a bank account 0 or 0 recurring=nothing, try convincing
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> the bank that the 0 counts as anything more than nothing.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> It is not the same as nothing. An empty bank account is not the same as no bank account.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> One is as useless as the other.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Not if you have an overdraft agreement.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> That's even worse.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Rubbish. Take the banks for all they've got!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> That's silly, an overdraft generates interest, doesn't it?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> So you lose.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Why do you think i have 12 bank accounts?
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> You mean you cover overdrafts in one accounf with cheques on another,
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> which are in turn covered by cheques on a third? That's known as
>>>>>>>>>>>>>>>>>>>>>>>>>>>>> "kiting" in the trade.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>> Or, flying by the seat of your pants.
>>>>>>>>>>>>>>>>>>>>>>>>>>> Once you lose your shirt, the pants are next!
>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>> Always wear clean underwear!
>>>>>>>>>>>>>>>>>>>>>>>>> If they're going to take those too, why make it pleasant for them?
>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>> Dirty pants = a dirty mind.
>>>>>>>>>>>>>>>>>>>>>>> You almost make that sound like a Bad Thing?.
>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> No, just pointing it out.
>>>>>>>>>>>>>>>>>>>>> It is, of course, a Good Thing?.
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Extreme filth!
>>>>>>>>>>>>>>>>>>> One hopes and prays.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Bring back debauchery.
>>>>>>>>>>>>>>>>> It left?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Only temporarily.
>>>>>>>>>>>>>>> Thank fuck for that!
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I do so enjoy a good bit of pillaging.
>>>>>>>>>>>>> Rape's good too.
>>>>>>>>>>>>>
>>>>>>>>>>>> Also good exercise.
>>>>>>>>>>> The ideal combination.
>>>>>>>>>>>
>>>>>>>>>> Keeeeeeeeeeeeeeep bonking!!
>>>>>>>>> You know it makes sense.
>>>>>>>>>
>>>>>>>> Clunk click, you've bent your dick!
>>>>>>> I knew there was something wrong with that Savile character.
>>>>>>>
>>>>>> Now then!...now then!!
>>>>> Smoking cigars is bad for your hair.
>>>>>
>>>> But keeps the flies away.
>>> Keeps just about everyone/everything away.
>>>
>> A good smokescreen for most things then?
>
> Smoke 'n mirrors.
>
It's just magic.