PC Review


Reply
Thread Tools Rate Thread

Asynchronous Serial port

 
 
shayke via DotNetMonster.com
Guest
Posts: n/a
 
      28th Nov 2005
Hello,

I am trying to write asynchronous serial port.
meaning, read and write operations are made via async cllbacks.
so far so good.
I open my port in continues state:
1)Set the BytesToRead property of the serial port.
2)open the port
3)generate read request
4)meanwhile generate write request.
5)in result, the read operation is executed(provided that the BytesToRead are
present n the stream)
i encountered a problem that despite of Setting the BytesToRead property,the
read operation is executed and reads 1 byte from the stream.
after the read operation is completed i generate another async read request
so the port is always in "Listening" mode.

am i doing something wrong?
can't i work asynchronically?
do i have to lock the stream or the port or the buffer itself?

Thanks

--
Message posted via http://www.dotnetmonster.com
 
Reply With Quote
 
 
 
 
shmulik via DotNetMonster.com
Guest
Posts: n/a
 
      29th Nov 2005
shayke wrote:
>Hello,
>
>I am trying to write asynchronous serial port.
>meaning, read and write operations are made via async cllbacks.
>so far so good.
>I open my port in continues state:
>1)Set the BytesToRead property of the serial port.
>2)open the port
>3)generate read request
>4)meanwhile generate write request.
>5)in result, the read operation is executed(provided that the BytesToRead are
>present n the stream)
>i encountered a problem that despite of Setting the BytesToRead property,the
>read operation is executed and reads 1 byte from the stream.
>after the read operation is completed i generate another async read request
>so the port is always in "Listening" mode.
>
>am i doing something wrong?
>can't i work asynchronically?
>do i have to lock the stream or the port or the buffer itself?
>
>Thanks



I encountered the same problem.at the first read operation the read operation
returns after reading only the first byte.i think it is a problem of timeout
settings.i am not sure.
anyone else knows???

--
Message posted via http://www.dotnetmonster.com
 
Reply With Quote
 
Helge Jensen
Guest
Posts: n/a
 
      30th Nov 2005


shayke via DotNetMonster.com wrote:

> am i doing something wrong?
> can't i work asynchronically?
> do i have to lock the stream or the port or the buffer itself?


In general, all .NET read primitives can read less bytes than "requested".

If bytes are not arriving fast the async read operation *should* return
a number of bytes less than BytesToRead.

If you need to wait until a certain number of bytes have arrived you
must copy those bytes into a buffer yourself and signal an event when
it's full.


--
Helge Jensen
private.php?do=newpm&u=
sip:(E-Mail Removed)
-=> Sebastian cover-music: http://ungdomshus.nu <=-
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial Port with C# serial port class problem BrianK Microsoft Dot NET Compact Framework 13 22nd Sep 2008 08:20 PM
asynchronous serial i/o Martijn Microsoft Dot NET 2 18th May 2008 05:11 PM
Cross Thread Exception after reading Asynchronous Serial Port Mo Microsoft C# .NET 5 12th Nov 2006 09:34 PM
Serial ATA AN (Asynchronous Notification) =?Utf-8?B?a3Bh?= Windows Vista Hardware 0 17th May 2006 01:03 AM
Serial Communication Slow, Increase Serial Port Interrupt Priority? Günter Wirth Microsoft Windows 2000 Developer 0 2nd Oct 2003 02:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:39 PM.